Files: efcf9fd06b02fa9bcd28681b4c777224e19702bb / test / test-50-spawn / test-cpfork-a-2.js
487 bytesRaw
1 | |
2 | |
3 | 'use strict'; |
4 | |
5 | var assert = require('assert'); |
6 | var cp = require('child_process'); |
7 | var child; |
8 | |
9 | assert(!process.send); |
10 | |
11 | try { |
12 | child = cp.fork( |
13 | require.resolve('./test-cpfork-a-child.js'), |
14 | [ 'argx', '--argvy' ] |
15 | ); |
16 | } catch (e) { |
17 | console.log(e.message); |
18 | } |
19 | |
20 | child.on('message', function (value) { |
21 | console.log(value.toString()); |
22 | child.send(value); |
23 | }); |
24 | |
25 | child.send(2); |
26 | |
27 | child.on('exit', function (code) { |
28 | console.log('Child exited with code', code); |
29 | }); |
30 |
Built with git-ssb-web