| Index: samples/shell.cc
|
| diff --git a/samples/shell.cc b/samples/shell.cc
|
| index b40eca2f7c0b696411e0db9b4d4101100d0baf50..db0cc1a930aa22a21b82a887fb362b1b8bc65944 100644
|
| --- a/samples/shell.cc
|
| +++ b/samples/shell.cc
|
| @@ -1,4 +1,4 @@
|
| -// Copyright 2011 the V8 project authors. All rights reserved.
|
| +// Copyright 2012 the V8 project authors. All rights reserved.
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| // met:
|
| @@ -67,17 +67,20 @@ static bool run_shell;
|
| int main(int argc, char* argv[]) {
|
| v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
|
| run_shell = (argc == 1);
|
| - v8::HandleScope handle_scope;
|
| - v8::Persistent<v8::Context> context = CreateShellContext();
|
| - if (context.IsEmpty()) {
|
| - printf("Error creating context\n");
|
| - return 1;
|
| + int result;
|
| + {
|
| + v8::HandleScope handle_scope;
|
| + v8::Persistent<v8::Context> context = CreateShellContext();
|
| + if (context.IsEmpty()) {
|
| + printf("Error creating context\n");
|
| + return 1;
|
| + }
|
| + context->Enter();
|
| + result = RunMain(argc, argv);
|
| + if (run_shell) RunShell(context);
|
| + context->Exit();
|
| + context.Dispose();
|
| }
|
| - context->Enter();
|
| - int result = RunMain(argc, argv);
|
| - if (run_shell) RunShell(context);
|
| - context->Exit();
|
| - context.Dispose();
|
| v8::V8::Dispose();
|
| return result;
|
| }
|
|
|