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