Question

I am creating a process from a javascript. Is there any way to know when the process execution has been completed?

In win32 we can wait of the process handle using waitforsingleobject and know when the process execution is completed. I am looking for something similar in javascript.

Following is the code snippet

var retValue = process.Create(shellCmd);

Here I need to know when the process has completed its execution.

Était-ce utile?

La solution

You need to use the Child Process module.

var spawn = require('child_process').spawn;
var dir   = spawn('dir', []);

dir.on('close', function (code) {
  console.log('child process exited with code ' + code);
});
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top