concurrently
Advanced tools
Comparing version 2.2.0 to 3.0.0-dev
{ | ||
"name": "concurrently", | ||
"version": "2.2.0", | ||
"description": "Run commands concurrently", | ||
"main": "src/main.js", | ||
"bin": { | ||
"concurrent": "./src/main.js", | ||
"concurrently": "./src/main.js" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/kimmobrunfeldt/concurrently.git" | ||
}, | ||
"keywords": [ | ||
"bash", | ||
"concurrent", | ||
"parallel", | ||
"concurrently", | ||
"command", | ||
"sh" | ||
], | ||
"author": "Kimmo Brunfeldt", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/kimmobrunfeldt/concurrently/issues" | ||
}, | ||
"homepage": "https://github.com/kimmobrunfeldt/concurrently", | ||
"dependencies": { | ||
"bluebird": "2.9.6", | ||
"chalk": "0.5.1", | ||
"commander": "2.6.0", | ||
"cross-spawn": "^0.2.9", | ||
"lodash": "^4.5.1", | ||
"moment": "^2.11.2", | ||
"rx": "2.3.24" | ||
}, | ||
"devDependencies": { | ||
"chai": "^1.10.0", | ||
"mocha": "^2.1.0", | ||
"mustache": "^1.0.0", | ||
"semver": "^4.2.0", | ||
"shell-quote": "^1.4.3", | ||
"shelljs": "^0.3.0", | ||
"string": "^3.0.0" | ||
} | ||
} | ||
"name": "concurrently", | ||
"version": "3.0.0-dev", | ||
"description": "Run commands concurrently", | ||
"main": "src/main.js", | ||
"bin": { | ||
"concurrent": "./src/main.js", | ||
"concurrently": "./src/main.js" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/kimmobrunfeldt/concurrently.git" | ||
}, | ||
"keywords": [ | ||
"bash", | ||
"concurrent", | ||
"parallel", | ||
"concurrently", | ||
"command", | ||
"sh" | ||
], | ||
"author": "Kimmo Brunfeldt", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/kimmobrunfeldt/concurrently/issues" | ||
}, | ||
"homepage": "https://github.com/kimmobrunfeldt/concurrently", | ||
"dependencies": { | ||
"bluebird": "2.9.6", | ||
"chalk": "0.5.1", | ||
"commander": "2.6.0", | ||
"lodash": "^4.5.1", | ||
"moment": "^2.11.2", | ||
"rx": "2.3.24", | ||
"spawn-default-shell": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"chai": "^1.10.0", | ||
"mocha": "^2.1.0", | ||
"mustache": "^1.0.0", | ||
"semver": "^4.2.0", | ||
"shell-quote": "^1.4.3", | ||
"shelljs": "^0.3.0", | ||
"string": "^3.0.0" | ||
} | ||
} |
@@ -5,2 +5,4 @@ # Concurrently | ||
[![NPM Badge](https://nodei.co/npm/concurrently.png?downloads=true)](https://www.npmjs.com/package/concurrently) | ||
**Version: 2.2.0** ([*previous stable*](https://github.com/kimmobrunfeldt/concurrently/tree/2.1.0)) | ||
@@ -18,4 +20,4 @@ | ||
* With `--kill-others` switch, all commands are killed if one dies | ||
* Spawns commands with [spawn-default-shell](https://github.com/kimmobrunfeldt/spawn-default-shell) | ||
## Install | ||
@@ -29,2 +31,8 @@ | ||
or if you are using it from npm scripts: | ||
```bash | ||
npm install concurrently --save | ||
``` | ||
## Usage | ||
@@ -40,2 +48,8 @@ | ||
In package.json, escape quotes: | ||
```bash | ||
"start": "concurrently \"command1 arg\" \"command2 arg\" | ||
``` | ||
Help: | ||
@@ -52,3 +66,3 @@ | ||
--no-color disable colors from logging | ||
--names names different processes, i.e --name "web,api,hot-server" to be used in the prefix switch | ||
--names names different processes, i.e --names "web,api,hot-server" to be used in the prefix switch | ||
-p, --prefix <prefix> prefix used in logging for each process. | ||
@@ -55,0 +69,0 @@ Possible values: index, pid, time, command, name, none or a template. Default: index. Example template "{time}-{pid}" |
@@ -10,3 +10,3 @@ #!/usr/bin/env node | ||
var chalk = require('chalk'); | ||
var spawn = Promise.promisifyAll(require('cross-spawn')); | ||
var defaultShell = require('spawn-default-shell'); | ||
var isWindows = /^win/.test(process.platform); | ||
@@ -172,31 +172,2 @@ | ||
function separateCmdArgs(cmd) { | ||
// We're splitting up the command into space-separated parts. | ||
// The first item is the command, all remaining items are the | ||
// arguments. To permit commands with spaces in the name | ||
// (or directory name), double slashes is a usable escape sequence. | ||
var escape = cmd.search('\\\s'), | ||
divide = cmd.search(/[^\\]\s/), | ||
path, args, parts; | ||
if (escape === -1) { | ||
// Not an escaped path. Most common case. | ||
parts = cmd.split(' '); | ||
} else if (escape > -1 && divide === -1) { | ||
// Escaped path without arguments. | ||
parts = [cmd.replace('\\ ', ' ')]; | ||
} else { | ||
// Escaped path with arguments. | ||
path = cmd.substr(0, divide + 1).replace('\\ ', ' '); | ||
args = cmd.substr(divide + 1).split(' ').filter(function(part) { | ||
return part.trim() != ''; | ||
}); | ||
parts = [path].concat(args); | ||
} | ||
// Parts contains the command as the first item and any arguments | ||
// as subsequent items. | ||
return parts; | ||
} | ||
function run(commands) { | ||
@@ -211,5 +182,2 @@ var childrenInfo = {}; | ||
// Split the command up in the command path and its arguments. | ||
var parts = separateCmdArgs(cmd); | ||
var spawnOpts = config.raw ? {stdio: 'inherit'} : {}; | ||
@@ -219,5 +187,6 @@ if (isWindows) { | ||
} | ||
var child; | ||
try { | ||
child = spawn(_.head(parts), _.tail(parts), spawnOpts); | ||
child = defaultShell.spawn(cmd, spawnOpts); | ||
} catch (e) { | ||
@@ -270,2 +239,10 @@ logError('', chalk.gray.dim, 'Error occured when executing command: ' + cmd); | ||
} | ||
['SIGINT', 'SIGTERM'].forEach(function(signal) { | ||
process.on(signal, function() { | ||
children.forEach(function(child) { | ||
child.kill(signal); | ||
}); | ||
}); | ||
}); | ||
} | ||
@@ -321,3 +298,3 @@ | ||
} else { | ||
child.kill('SIGINT'); | ||
child.kill('SIGTERM'); | ||
} | ||
@@ -324,0 +301,0 @@ }); |
@@ -78,2 +78,49 @@ // Test basic usage of cli | ||
['SIGINT', 'SIGTERM'].forEach(function(signal) { | ||
it('killing it with ' + signal + ' should propagate the signal to the children', function(done) { | ||
var readline = require('readline'); | ||
var waitingStart = 2; | ||
var waitingSignal = 2; | ||
function waitForSignal(cb) { | ||
if (waitingSignal) { | ||
setTimeout(waitForSignal, 100); | ||
} else { | ||
cb(); | ||
} | ||
} | ||
run('node ./src/main.js "node ./test/support/signal.js" "node ./test/support/signal.js"', { | ||
pipe: false, | ||
callback: function(child) { | ||
var rl = readline.createInterface({ | ||
input: child.stdout, | ||
output: null | ||
}); | ||
rl.on('line', function(line) { | ||
if (DEBUG_TESTS) { | ||
console.log(line); | ||
} | ||
// waiting for startup | ||
if (/STARTED/.test(line)) { | ||
waitingStart--; | ||
} | ||
if (!waitingStart) { | ||
// both processes are started | ||
child.kill(signal); | ||
} | ||
// waiting for signal | ||
if (new RegExp(signal).test(line)) { | ||
waitingSignal--; | ||
} | ||
}); | ||
} | ||
}).then(function() { | ||
waitForSignal(done); | ||
}); | ||
}); | ||
}); | ||
}); | ||
@@ -80,0 +127,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
135374
16
742
137
1
+ Addedspawn-default-shell@^1.0.0
+ Addedspawn-default-shell@1.1.0(transitive)
- Removedcross-spawn@^0.2.9
- Removedcross-spawn@0.2.9(transitive)
- Removedlru-cache@2.7.3(transitive)