From b74d119b3487b62d81908c76151f252edd46e6cc Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 23 Jun 2011 22:44:10 +0200 Subject: [PATCH] Parse the command line before initializing V8. Doing it the other way around means that V8 won't pick up command line switches like `--prof`. Props to Joshua Kehn for reporting the issue and Jeff Fifield for pointing out the cause. Fixes #900. Fixes #1217. --- src/node.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/node.cc b/src/node.cc index 70f91414f3..9b7f247998 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2486,11 +2486,13 @@ void EmitExit(v8::Handle process) { int Start(int argc, char *argv[]) { uv_init(); - v8::V8::Initialize(); - v8::HandleScope handle_scope; + // This needs to run *before* V8::Initialize() argv = Init(argc, argv); + v8::V8::Initialize(); + v8::HandleScope handle_scope; + // Create the one and only Context. Persistent context = v8::Context::New(); v8::Context::Scope context_scope(context);