Answers for "node spawn"

2

node spawn

const { spawn } = require('child_process');
const ls = spawn('ls', ['-lh', '/usr']);

ls.stdout.on('data', (data) => {
  console.log(`stdout: ${data}`);
});

ls.stderr.on('data', (data) => {
  console.error(`stderr: ${data}`);
});

ls.on('close', (code) => {
  console.log(`child process exited with code ${code}`);
});
Posted by: Guest on July-10-2020
0

how to return when child process is complete in node js

var child = require('child_process').exec('python celulas.py')
child.stdout.pipe(process.stdout)
child.on('exit', function() {
  process.exit()
})
Posted by: Guest on June-11-2020
0

how to return when child process is complete in node js

var execSync = require('exec-sync');

var user = execSync('python celulas.py');
Posted by: Guest on June-11-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language