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 #library('minfrog'); | 5 #library('minfrog'); |
6 | 6 |
7 #import('lib/node/node.dart'); | 7 #import('lib/node/node.dart'); |
| 8 #import('lib/node/path.dart'); |
| 9 #import('lib/node/fs.dart'); |
| 10 #import('lib/node/vm.dart'); |
8 #import('file_system_node.dart'); | 11 #import('file_system_node.dart'); |
9 #import('lang.dart'); | 12 #import('lang.dart'); |
10 | 13 |
11 void main() { | 14 void main() { |
12 // Get the home directory from our executable. | 15 // Get the home directory from our executable. |
13 var homedir = path.dirname(fs.realpathSync(process.argv[1])); | 16 var homedir = path.dirname(fs.realpathSync(process.argv[1])); |
14 | 17 |
15 // Note: we create a copy of argv here because the one that is passed in is | 18 // Note: we create a copy of argv here because the one that is passed in is |
16 // potentially a JS Array object from outside the sandbox. Hence it will have | 19 // potentially a JS Array object from outside the sandbox. Hence it will have |
17 // the wrong prototype. | 20 // the wrong prototype. |
(...skipping 21 matching lines...) Expand all Loading... |
39 process.argv.addAll(options.childArgs); | 42 process.argv.addAll(options.childArgs); |
40 // TODO(jmesserly): we shouldn't force the child process to patch argv. | 43 // TODO(jmesserly): we shouldn't force the child process to patch argv. |
41 // Instead, we should be injecting code into the child to fix argv's | 44 // Instead, we should be injecting code into the child to fix argv's |
42 // prototype (and possible the proto of require, process, and console). | 45 // prototype (and possible the proto of require, process, and console). |
43 vm.runInNewContext(code, createSandbox()); | 46 vm.runInNewContext(code, createSandbox()); |
44 } | 47 } |
45 } else { | 48 } else { |
46 process.exit(1); | 49 process.exit(1); |
47 } | 50 } |
48 } | 51 } |
OLD | NEW |