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