Additionally, how to spawn a child process that ignore SIGTERM
and can only be killed by SIGKILL
?
Asked
Active
Viewed 842 times
0

ydydyd
- 71
- 2
- 9
-
Have you a concrete application in mind ? Or some example to clarify what you actually want to do ? – TGrif Feb 28 '19 at 19:29
-
Basically i want to have enhance https://github.com/sindresorhus/noop-process to have a option to create a process that can only be killed be `SIGKILL` and used later by my app. – ydydyd Feb 28 '19 at 20:47
1 Answers
0
Because this option is associated with the timeout
option.
In spawn
you have to decide when you kill the process.
Example: (from doc)
const { spawn } = require('child_process');
const grep = spawn('grep', ['ssh']);
grep.on('close', (code, signal) => {
console.log(
`child process terminated due to receipt of signal ${signal}`);
});
// Send SIGHUP to process
grep.kill('SIGHUP');

bato3
- 2,695
- 1
- 18
- 26
-
Thanks! so there is no way to ignore `SIGTERM` for `spawn`ed child process? – ydydyd Mar 01 '19 at 02:18
-
the command you are running should not support SIGTERM, eg: https://stackoverflow.com/a/21660539/1194525 – bato3 Mar 01 '19 at 02:27