Index: samples/shell.cc |
diff --git a/samples/shell.cc b/samples/shell.cc |
index b40eca2f7c0b696411e0db9b4d4101100d0baf50..37a05b99e21a8363a3e469463a149834aff9e734 100644 |
--- a/samples/shell.cc |
+++ b/samples/shell.cc |
@@ -246,17 +246,18 @@ int RunMain(int argc, char* argv[]) { |
// The read-eval-execute loop of the shell. |
void RunShell(v8::Handle<v8::Context> context) { |
- printf("V8 version %s [sample shell]\n", v8::V8::GetVersion()); |
- static const int kBufferSize = 256; |
// Enter the execution environment before evaluating any code. |
+ v8::HandleScope handle_scope; |
v8::Context::Scope context_scope(context); |
v8::Local<v8::String> name(v8::String::New("(shell)")); |
+ |
+ printf("V8 version %s [sample shell]\n", v8::V8::GetVersion()); |
+ static const int kBufferSize = 256; |
while (true) { |
char buffer[kBufferSize]; |
printf("> "); |
char* str = fgets(buffer, kBufferSize, stdin); |
if (str == NULL) break; |
- v8::HandleScope handle_scope; |
ExecuteString(v8::String::New(str), name, true, true); |
} |
printf("\n"); |