Category : spawn

I want to call another shell script from javascript in a subprocess and pass values ​​to its standard input in order. I wrote it as follows. const cp = require("child_process"); let counter = 0; function getResult(stdout) { return new Promise(resolve => { stdout.on(‘data’, data => { counter ++; console.log(counter); resolve(`success(${counter})`); }) }) } exports.handler = ..

Read more

I have a child process. The Questions is: Does the child process need to be killed manually? Will the child process continue to run even if my application is shut down? Will the child process automatically killed if the main application dies? Example import { spawn } from ‘child_process’ const backTaskProcess = spawn(process.execPath, [‘back-task.js’], { ..

Read more