OS X changes
This commit is contained in:
15
helpers.js
15
helpers.js
@@ -125,7 +125,7 @@ module.exports.executeAndWait = command => {
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.executeAsync = (command) => {
|
||||
module.exports.executeAsync = (command, args=[]) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const launchProcess = (count, timeout) => {
|
||||
const processOptions = {
|
||||
@@ -133,7 +133,7 @@ module.exports.executeAsync = (command) => {
|
||||
shell: true,
|
||||
};
|
||||
|
||||
const process = new spawn(command, [], processOptions);
|
||||
const process = new spawn(command, args, processOptions);
|
||||
const pid = process.pid;
|
||||
|
||||
process.on('error', (err) => {
|
||||
@@ -146,10 +146,13 @@ module.exports.executeAsync = (command) => {
|
||||
});
|
||||
|
||||
process.on('exit', (code) => {
|
||||
if (++count === 5) {
|
||||
reject(code, pid);
|
||||
} else {
|
||||
setTimeout(()=>launchProcess(count, setTimeout(() => resolve(), 3000)), 1000);
|
||||
if (code !== 0) {
|
||||
if (++count === 5) {
|
||||
reject(code, pid);
|
||||
} else {
|
||||
clearTimeout(timeout);
|
||||
setTimeout(() => launchProcess(count, setTimeout(() => resolve(), 3000)), 1000);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user