Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #import('lib/node/node.dart'); | 5 #import('lib/node/node.dart'); |
| 6 #import('file_system_node.dart'); | 6 #import('file_system_node.dart'); |
| 7 #import('lang.dart'); | 7 #import('lang.dart'); |
| 8 | 8 |
| 9 void main() { | 9 void main() { |
| 10 // Get the home directory from our executable. | 10 // Get the home directory from our executable. |
| 11 var homedir = path.dirname(fs.realpathSync(process.argv[1])); | 11 var homedir = path.dirname(fs.realpathSync(process.argv[1])); |
| 12 if (compile(homedir, process.argv, new NodeFileSystem())) { | 12 |
| 13 // Note: we create a copy of argv here because the one that is passed in is | |
| 14 // potentially a JS Array object from outside the sandbox. Hence it will have | |
| 15 // the wrong prototype. | |
| 16 var argv = new List.from(process.argv); | |
|
jimhug
2011/11/07 16:41:26
TODO: This seems like a bug in the node interop th
Jennifer Messerly
2011/11/07 22:13:10
It's a bug in our createSandbox. We pass certain o
| |
| 17 | |
| 18 if (compile(homedir, argv, new NodeFileSystem())) { | |
| 13 var code = world.getGeneratedCode(); | 19 var code = world.getGeneratedCode(); |
| 14 if (!options.compileOnly) { | 20 if (!options.compileOnly) { |
| 15 process.argv = [process.argv[0], process.argv[1]]; | 21 process.argv = [argv[0], argv[1]]; |
| 16 process.argv.addAll(options.childArgs); | 22 process.argv.addAll(options.childArgs); |
| 17 vm.runInNewContext(code, createSandbox()); | 23 vm.runInNewContext(code, createSandbox()); |
| 18 } | 24 } |
| 19 } else { | 25 } else { |
| 20 process.exit(1); | 26 process.exit(1); |
| 21 } | 27 } |
| 22 } | 28 } |
| OLD | NEW |