Skip to content

Instantly share code, notes, and snippets.

@takuya
Created December 9, 2011 17:13
Show Gist options
  • Save takuya/1452427 to your computer and use it in GitHub Desktop.
Save takuya/1452427 to your computer and use it in GitHub Desktop.
v8 javascript patch for using shebang
--- shell.cc.orig 2010-05-14 15:21:28.000000000 -0500
+++ shell.cc 2010-05-14 15:26:54.000000000 -0500
@@ -211,6 +211,13 @@
i += read;
}
fclose(file);
+
+ // allow the first line to be a shebang (by commenting it out).
+ if ((chars[0] == '#') && (chars[1] == '!')) {
+ chars[0] = '/';
+ chars[1] = '/';
+ }
+
v8::Handle<v8::String> result = v8::String::New(chars, size);
delete[] chars;
return result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment