Skip to content

Commit

Permalink
fix: support signal on CLI (#1061)
Browse files Browse the repository at this point in the history
  • Loading branch information
timothykang authored and remy committed Sep 4, 2017
1 parent abc138f commit 3c352f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lib/cli/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
8 changes: 5 additions & 3 deletions test/cli/parse.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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');
});
});

Expand Down

0 comments on commit 3c352f2

Please sign in to comment.