質問

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.

役に立ちましたか?

解決

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);
});
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top