I'm spawning a child process using Node 6.9.
const child = require('child_process').execFile('command', args);
child.stdout.on('data', (data) => {
console.log('child:', data);
});
child.stderr.on('data', (data) => {
console.log('child:', data);
});
child.on('close', (code, signal) => {
console.log(`ERROR: child terminated. Exit code: ${code}, signal: ${signal}`);
});
My child process runs for ~1m 30s but then I get this output from my Node.js program:
ERROR: child terminated. Exit code: null, signal: SIGTERM
What terminates my child process and why?
Edit: I've added killSignal: 'SIGILL' as an option.
var child = require('child_process').execFile('geth', args, { killSignal: 'SIGILL'});
Now, I get this:
ERROR: go-ethereum terminated. Exit code: 2, signal: null
I found the problem and a solution.
maxBuffer largest amount of data (in bytes) allowed on stdout or stderr - if exceeded child process is killed (Default: 200*1024)
I can set the maxBuffer
option higher.
childProcess.execFile('geth', args, { maxBuffer: 400 * 1024});
It seems you can't disable the maxBuffer
option, not even by setting it to 0. But it seems to be on purpose.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.