summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2014-03-31 14:22:49 +0200
committerFedor Indutny <fedor@indutny.com>2014-04-01 18:55:52 +0400
commit490d5ab7808aedb998d1f4f933bf3de748758f62 (patch)
treee79c5e341f1646ddeb99e41375ff530f49f26eb8 /src
parente9ce8fc82a6d12e790511b62852e820d8be03186 (diff)
downloadandroid-node-v8-490d5ab7808aedb998d1f4f933bf3de748758f62.tar.gz
android-node-v8-490d5ab7808aedb998d1f4f933bf3de748758f62.tar.bz2
android-node-v8-490d5ab7808aedb998d1f4f933bf3de748758f62.zip
configure: make --v8-options switch more robust
Improve on commit b55c9d6 by not requiring that switches are comma separated. This commit makes `./configure --v8-options="--foo --bar"` work and takes special care to properly escape quotes in the options string.
Diffstat (limited to 'src')
-rw-r--r--src/node.cc27
1 files changed, 6 insertions, 21 deletions
diff --git a/src/node.cc b/src/node.cc
index 5c2a885cd2..65de300159 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -3062,26 +3062,6 @@ static void ParseArgs(int* argc,
}
-static void SetCompileTimeV8Options(const char** argv) {
-#ifdef NODE_V8_OPTIONS
- int v8_argc;
- static const char* v8_argv[] = { NULL, NODE_V8_OPTIONS };
- if (ARRAY_SIZE(v8_argv) == 1)
- return;
-
- v8_argv[0] = argv[0];
- v8_argc = ARRAY_SIZE(v8_argv);
- V8::SetFlagsFromCommandLine(&v8_argc, const_cast<char**>(v8_argv), true);
-
- // Anything that's still in v8_argv is not a V8 or a node option.
- for (int i = 1; i < v8_argc; i++)
- fprintf(stderr, "%s: bad option: %s\n", argv[0], v8_argv[i]);
- if (v8_argc > 1)
- exit(9);
-#endif // NODE_V8_OPTIONS
-}
-
-
// Called from V8 Debug Agent TCP thread.
static void DispatchMessagesDebugAgentCallback() {
uv_async_send(&dispatch_debug_messages_async);
@@ -3375,7 +3355,12 @@ void Init(int* argc,
DispatchDebugMessagesAsyncCallback);
uv_unref(reinterpret_cast<uv_handle_t*>(&dispatch_debug_messages_async));
- SetCompileTimeV8Options(argv);
+#if defined(NODE_V8_OPTIONS)
+ // Should come before the call to V8::SetFlagsFromCommandLine()
+ // so the user can disable a flag --foo at run-time by passing
+ // --no_foo from the command line.
+ V8::SetFlagsFromString(NODE_V8_OPTIONS, sizeof(NODE_V8_OPTIONS) - 1);
+#endif
// Parse a few arguments which are specific to Node.
int v8_argc;