Files: 65191f9a9664f013ebe726bb95a1a54b086e1bd5 / test / test-50-spawn / test-spawn-a-5.js
559 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.argv[0], [ |
15 | path.join(process.cwd(), path.basename(__filename)), 'argvx', '--argvy' |
16 | ], { stdio: [ 'inherit', 'inherit', 'inherit', 'ipc' ] } |
17 | ); |
18 | |
19 | child.on('message', function (value) { |
20 | console.log(value.toString()); |
21 | child.send(value); |
22 | }); |
23 | |
24 | child.send(2); |
25 | |
26 | child.on('exit', function (code) { |
27 | console.log('Child exited with code', code); |
28 | }); |
29 |
Built with git-ssb-web