Files: 65191f9a9664f013ebe726bb95a1a54b086e1bd5 / test / test-50-spawn / test-spawn-b-child.js
607 bytesRaw
1 | |
2 | |
3 | 'use strict'; |
4 | |
5 | var assert = require('assert'); |
6 | var cluster = require('cluster'); |
7 | |
8 | assert(process.send); |
9 | assert(!cluster.worker); |
10 | |
11 | console.log('Hello from spawn-b-child!'); |
12 | console.log('Args', JSON.stringify(process.argv.slice(2))); |
13 | |
14 | process.on('message', function (value) { |
15 | if (value === 128) process.exit(); |
16 | process.send(value * 2); |
17 | }); |
18 | |
19 | var fs = require('fs'); |
20 | |
21 | try { |
22 | // must patch fs even if entrypoint is not in snapshot |
23 | console.log(fs.readFileSync('dirty-hack-for-testing-purposes')); |
24 | } catch (error) { |
25 | if (!process.pkg) console.log('dirty-hack-for-testing-purposes'); |
26 | } |
27 |
Built with git-ssb-web