Skip to content

Commit 45d2b34

Browse files
Merge pull request open-cli-tools#39 from daniloster/master
Fix for nested concurrently --kill-others for MAC and windows fix for…
2 parents 1e474ac + 69a9ba6 commit 45d2b34

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/main.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ var program = require('commander');
88
var _ = require('lodash');
99
var chalk = require('chalk');
1010
var spawn = Promise.promisifyAll(require('cross-spawn'));
11+
var isWindows = /^win/.test(process.platform);
1112

1213
var config = {
1314
// Kill other processes if one dies
@@ -209,6 +210,9 @@ function run(commands) {
209210
var parts = separateCmdArgs(cmd);
210211

211212
var spawnOpts = config.raw ? {stdio: 'inherit'} : {};
213+
if (isWindows) {
214+
spawnOpts.detached = false;
215+
}
212216
var child;
213217
try {
214218
child = spawn(_.head(parts), _.tail(parts), spawnOpts);
@@ -306,7 +310,11 @@ function handleClose(streams, children, childrenInfo) {
306310

307311
// Send SIGTERM to alive children
308312
_.each(aliveChildren, function(child) {
309-
child.kill();
313+
if (isWindows) {
314+
spawn('taskkill', ["/pid", child.pid, '/f', '/t']);
315+
} else {
316+
child.kill('SIGINT');
317+
}
310318
});
311319
});
312320
}

test/test-functional.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('concurrently', function() {
4141
});
4242

4343
it('at least one unsuccessful commands should exit non-zero', function(done) {
44-
run('node ./src/main.js "echo" "exit 1" "echo"', {pipe: DEBUG_TESTS})
44+
run('node ./src/main.js "echo" "return 1" "echo"', {pipe: DEBUG_TESTS})
4545
.then(function(exitCode) {
4646
assert.notStrictEqual(exitCode, 0);
4747
done();

0 commit comments

Comments
 (0)