Fix command / working directory extraction
This commit is contained in:
@@ -288,8 +288,8 @@ module.exports.executeAndWait = (command, ignoreResult) => {
|
||||
module.exports.executeAsync = (command, args=[]) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const launchProcess = (count, timeout) => {
|
||||
const working = path.dirname(command);
|
||||
command = path.basename(command);
|
||||
const cmd = path.basename(command);
|
||||
const working = cmd.length === command.length ? null : command.substr(0, command.length - cmd.length);
|
||||
let processOptions = {
|
||||
detached: true,
|
||||
shell: false,
|
||||
@@ -298,10 +298,10 @@ module.exports.executeAsync = (command, args=[]) => {
|
||||
processOptions.cwd = working;
|
||||
}
|
||||
|
||||
const process = new spawn(command, args, processOptions);
|
||||
const process = new spawn(cmd, args, processOptions);
|
||||
const pid = process.pid;
|
||||
|
||||
process.on('error', (err) => {
|
||||
process.on('error', err => {
|
||||
if (++count === 5) {
|
||||
reject(err, pid);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user