fix: support signal on CLI (#1061)

This commit is contained in:
Tim Kang
2017-09-04 11:41:35 -07:00
committed by Remy Sharp
parent abc138f570
commit 3c352f2f27
2 changed files with 9 additions and 3 deletions

View File

@@ -194,6 +194,10 @@ function nodemonOption(options, arg, eatNext) {
options.colours = false;
} else
if (arg === '--signal' || arg === '-s') {
options.signal = eatNext();
} else
if (arg === '--cwd') {
options.cwd = eatNext();

View File

@@ -232,7 +232,7 @@ describe('nodemon argument parser', function () {
});
it('should support short versions of flags', function () {
var settings = cli.parse('node nodemon -v -x java -I -V -q -w fixtures -i fixtures -d 5 -L -C -e jade');
var settings = cli.parse('node nodemon -v -x java -I -V -q -w fixtures -i fixtures -d 5 -L -C -e jade -s SIGHUP');
assert(settings.version, 'version');
assert(settings.verbose, 'verbose');
assert(settings.exec === 'java', 'exec');
@@ -243,11 +243,12 @@ describe('nodemon argument parser', function () {
assert(settings.delay === 5000, 'delay 5 seconds');
assert(settings.runOnChangeOnly, 'run on change only');
assert(settings.ext === 'jade', 'extension is jade');
assert(settings.signal === 'SIGHUP', 'signal is SIGHUP');
});
it('should support long versions of flags', function () {
var settings = cli.parse('node nodemon --version --exec java --verbose --quiet --watch fixtures --ignore fixtures --no-stdin --delay 5 --legacy-watch --exitcrash --on-change-only --ext jade --config my/.nodemon.json');
var settings = cli.parse('node nodemon --version --exec java --verbose --quiet --watch fixtures --ignore fixtures --no-stdin --delay 5 --legacy-watch --exitcrash --on-change-only --ext jade --config my/.nodemon.json --signal SIGHUP');
assert(settings.version, 'version');
assert(settings.verbose, 'verbose');
assert(settings.exec === 'java', 'exec');
@@ -259,7 +260,8 @@ describe('nodemon argument parser', function () {
assert(settings.delay === 5000, 'delay 5 seconds');
assert(settings.runOnChangeOnly, 'run on change only');
assert(settings.ext === 'jade', 'extension is jade');
assert(settings.configFile === 'my/.nodemon.json', 'custom config file name is my/.nodemon.json')
assert(settings.configFile === 'my/.nodemon.json', 'custom config file name is my/.nodemon.json');
assert(settings.signal === 'SIGHUP', 'signal is SIGHUP');
});
});