Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: dart/frog/tests/frog/src/NodeProcessHelper.dart

Issue 10164004: Remove frogsh. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 #library('NodeProcessHelper');
6
7 #import('../../../lib/node/node.dart');
8 #import('NodeTestHelper.dart');
9
10 // This program is designed to be executed as a sub-process by NodeProcessTest
11 // (Node doesn't expose "dup" or "dup2", so this is the only way to capture
12 // the output of stderr, stdout during testing.)
13
14 main() {
15 printTestOutputBanner();
16 var argv = process.argv;
17 switch (argv[2]) {
18 case 'event-exit':
19 process.onExit(() => console.log('exit'));
20 break;
21
22 case 'event-uncaughtException':
23 process.onUncaughtException((Exception err) =>
24 console.log('uncaughtException: ' + err));
25 /*
26 try {
27 throw new Exception('exception1');
28 } catch (Exception e) {
29 // ignore
30 }
31 */
32 throw new Exception('exception2');
33
34 case 'event-catchsignal':
35 process.onSignal('SIGUSR1', () => console.log('caught signal'));
36 process.kill(process.pid, 'SIGUSR1');
37 break;
38
39 case 'stdout':
40 process.stdout.write('stdout\n');
41 break;
42
43 case 'stderr':
44 process.stderr.write('stderr\n');
45 break;
46
47 case 'stdin':
48 // copy stdin to stdout, assumes caller will write to stdin
49 process.stdin.resume();
50 process.stdin.pipe(process.stdout);
51 break;
52
53 case 'argv':
54 console.log(process.argv[2]);
55 break;
56
57 case 'execPath':
58 console.log(process.execPath);
59 break;
60
61 case 'chdir-cwd':
62 process.chdir('/');
63 console.log(process.cwd());
64 break;
65
66 // case 'env':
67 // TODO(jackpal): env not implemented.
68 // console.log(process.env['PWD']);
69 // break;
70
71 case 'exitCode':
72 process.exit(42);
73 break;
74
75 case 'gid':
76 console.log(process.getgid().toString());
77 break;
78
79 case 'uid':
80 console.log(process.getuid().toString());
81 break;
82
83 default:
84 console.error('unknown argument. argv=${argv}');
85 break;
86 }
87 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698