Skip to content

Commit 3c352f2

Browse files
timothykangremy
authored andcommitted
fix: support signal on CLI (#1061)
1 parent abc138f commit 3c352f2

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/cli/parse.js

+4
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ function nodemonOption(options, arg, eatNext) {
194194
options.colours = false;
195195
} else
196196

197+
if (arg === '--signal' || arg === '-s') {
198+
options.signal = eatNext();
199+
} else
200+
197201
if (arg === '--cwd') {
198202
options.cwd = eatNext();
199203

test/cli/parse.test.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ describe('nodemon argument parser', function () {
232232
});
233233

234234
it('should support short versions of flags', function () {
235-
var settings = cli.parse('node nodemon -v -x java -I -V -q -w fixtures -i fixtures -d 5 -L -C -e jade');
235+
var settings = cli.parse('node nodemon -v -x java -I -V -q -w fixtures -i fixtures -d 5 -L -C -e jade -s SIGHUP');
236236
assert(settings.version, 'version');
237237
assert(settings.verbose, 'verbose');
238238
assert(settings.exec === 'java', 'exec');
@@ -243,11 +243,12 @@ describe('nodemon argument parser', function () {
243243
assert(settings.delay === 5000, 'delay 5 seconds');
244244
assert(settings.runOnChangeOnly, 'run on change only');
245245
assert(settings.ext === 'jade', 'extension is jade');
246+
assert(settings.signal === 'SIGHUP', 'signal is SIGHUP');
246247
});
247248

248249

249250
it('should support long versions of flags', function () {
250-
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');
251+
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');
251252
assert(settings.version, 'version');
252253
assert(settings.verbose, 'verbose');
253254
assert(settings.exec === 'java', 'exec');
@@ -259,7 +260,8 @@ describe('nodemon argument parser', function () {
259260
assert(settings.delay === 5000, 'delay 5 seconds');
260261
assert(settings.runOnChangeOnly, 'run on change only');
261262
assert(settings.ext === 'jade', 'extension is jade');
262-
assert(settings.configFile === 'my/.nodemon.json', 'custom config file name is my/.nodemon.json')
263+
assert(settings.configFile === 'my/.nodemon.json', 'custom config file name is my/.nodemon.json');
264+
assert(settings.signal === 'SIGHUP', 'signal is SIGHUP');
263265
});
264266
});
265267

0 commit comments

Comments
 (0)