-
Notifications
You must be signed in to change notification settings - Fork 100
Open
Description
I'm copying some binaries file to another folder, then executing a binary in the callback
but i'm getting as a result Error: spawn EBUSY
internal/child_process.js:328
throw errnoException(err, 'spawn');
^
Error: spawn EBUSY
at exports._errnoException (util.js:1020:11)
at ChildProcess.spawn (internal/child_process.js:328:11)
at exports.spawn (child_process.js:370:9)
The Script:
const spawn = require("child_process").spawn;
const execPath = path.resolve( __dirname, "/dest" );
const binPath = path.resolve( __dirname, "/.bin" );
rimraf(execPath, function (err) {
if (err) {
throw err;
}
mkdirp(execPath, {}, function (err) {
if (err) {
throw err;
}
ncp(binPath , execPath, { clobber: false }, function (err) {
if (err) {
throw err;
}
let args = ["--arg1"];
let cmd = path.resolve(execPath , "sometool.exe");
spawn(cmd, args);
});
});
});
if i add a setTimeout where the binary is called, it works
const spawn = require("child_process").spawn;
const execPath = path.resolve( __dirname, "/dest" );
const binPath = path.resolve( __dirname, "/.bin" );
rimraf(execPath, function (err) {
if (err) {
throw err;
}
mkdirp(execPath, {}, function (err) {
if (err) {
throw err;
}
ncp(binPath , execPath, { clobber: false }, function (err) {
if (err) {
throw err;
}
let args = ["--arg1"];
let cmd = path.resolve(execPath , "sometool.exe");
//NOW IT WORKS
setTimeout( ()=> spawn(cmd, args), 1000);
});
});
});
andrewjmead and CoryBond
Metadata
Metadata
Assignees
Labels
No labels