send a child proces some data node js exec file code example
Example 1: child process
const { exec, spawn } = require('child_process');
exec('my.bat', (err, stdout, stderr) => {
if (err) {
console.error(err);
return;
}
console.log(stdout);
});
const bat = spawn('"my script.cmd"', ['a', 'b'], { shell: true });
exec('"my script.cmd" a b', (err, stdout, stderr) => {
});
Example 2: how to return when child process is complete in node js
var execSync = require('exec-sync');
var user = execSync('python celulas.py');