Files: 4c58f1c6c3ddb86a97f27f0c84681d201ef1f75f / test / test-50-spawn / test-cpfork-a-1.js
460 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 | ); |
15 | } catch (e) { |
16 | console.log(e.message); |
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