Add status code to error on Windows and macOS
This commit is contained in:
parent
a9f1a9e58e
commit
810e87f9ba
1 changed files with 8 additions and 2 deletions
10
index.js
10
index.js
|
@ -326,7 +326,10 @@ function MacResult(instance, end) {
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
end(undefined, stdout, stderr);
|
end(undefined, stdout, stderr);
|
||||||
} else {
|
} else {
|
||||||
error = new Error('Command failed: ' + instance.command);
|
error = new Error(
|
||||||
|
'Command failed: ' + instance.command + '\n' + stderr
|
||||||
|
);
|
||||||
|
error.code = code;
|
||||||
end(error, stdout, stderr);
|
end(error, stdout, stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -489,7 +492,10 @@ function WindowsResult(instance, end) {
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
end(undefined, stdout, stderr);
|
end(undefined, stdout, stderr);
|
||||||
} else {
|
} else {
|
||||||
error = new Error('Command failed: ' + instance.command);
|
error = new Error(
|
||||||
|
'Command failed: ' + instance.command + '\r\n' + stderr
|
||||||
|
);
|
||||||
|
error.code = code;
|
||||||
end(error, stdout, stderr);
|
end(error, stdout, stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue