Files: ca90b5ca0579ebdcc0635288bce4978e3fb200f5 / test / test-50-spawn / test-spawn-a-2.js
530 bytesRaw
1 | |
2 | |
3 | 'use strict'; |
4 | |
5 | var path = require('path'); |
6 | var spawn = require('child_process').spawn; |
7 | |
8 | if (process.send) { |
9 | require('./test-spawn-a-child.js'); |
10 | return; |
11 | } |
12 | |
13 | var child = spawn( |
14 | process.execPath, [ path.basename(__filename), 'argvx', '--argvy' ], |
15 | { stdio: [ 'inherit', 'inherit', 'inherit', 'ipc' ] } |
16 | ); |
17 | |
18 | child.on('message', function (value) { |
19 | console.log(value.toString()); |
20 | child.send(value); |
21 | }); |
22 | |
23 | child.send(2); |
24 | |
25 | child.on('exit', function (code) { |
26 | console.log('Child exited with code', code); |
27 | }); |
28 |
Built with git-ssb-web