1 | var util = require('util'),
|
2 | path = require('path'),
|
3 | spawn = require('child_process').spawn;
|
4 |
|
5 | var child = spawn('node', [path.join(__dirname, 'count-timer.js')], { cwd: __dirname });
|
6 |
|
7 | child.stdout.on('data', function (data) {
|
8 | util.puts(data);
|
9 | //throw new Error('User generated fault.');
|
10 | });
|
11 |
|
12 | child.stderr.on('data', function (data) {
|
13 | util.puts(data);
|
14 | });
|
15 |
|
16 | child.on('exit', function (code) {
|
17 | util.puts('Child process exited with code: ' + code);
|
18 | });
|