'Node.js child process exits with SIGTERM

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


Solution 1:[1]

I found the problem and a solution.

From https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_child_process_execfile_file_args_options_callback

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mitchkman