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