Skip to content

Commit c4a86da

Browse files
committed
Fix: Add a workaround for Git Bash for Windows (fixes #24)
1 parent 262d244 commit c4a86da

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/bin/npm-run-all.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,14 @@ if (require.main === module) {
4242
const promise = main(process.argv.slice(2), process.stdout, process.stderr);
4343

4444
// Error Handling.
45-
promise.catch(err => {
46-
console.error("ERROR:", err.message); // eslint-disable-line no-console
47-
process.exit(1);
48-
});
45+
promise.then(
46+
() => {
47+
// I'm not sure why, but maybe the process never exits on Git Bash (MINGW64)
48+
process.exit(0);
49+
},
50+
(err) => {
51+
console.error("ERROR:", err.message); // eslint-disable-line no-console
52+
process.exit(1);
53+
}
54+
);
4955
}

src/lib/run-task.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import spawn from "./spawn";
1616
function detectStreamKind(stream, std) {
1717
return (
1818
stream == null ? "ignore" :
19-
stream !== std ? "pipe" :
19+
// `|| !std.isTTY` is needed for the workaround of https://github.com/nodejs/node/issues/5620
20+
stream !== std || !std.isTTY ? "pipe" :
2021
/* else */ stream
2122
);
2223
}

0 commit comments

Comments
 (0)