Skip to content

Commit c0df64c

Browse files
committed
fix --exit-child
1 parent 871ea65 commit c0df64c

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ tsnd --respawn server.ts
4545
- `--debounce` - Debounce file change events (ms, non-polling mode)
4646
- `--clear` (`--cls`) Will clear screen on restart
4747
- `--watch` - Explicitly add files or folders to watch and restart on change (list separated by commas)
48+
- `--exit-child` - Adds 'SIGTERM' exit handler in a child process.
4849

4950
**Caveats and points of notice:**
5051

lib/compiler.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ var compiler = {
7373
}
7474
if (options['exec-check']) {
7575
fileData = fileData.replace('execCheck = false', 'execCheck = true')
76-
}
76+
}
77+
7778
if (options['exit-child']) {
78-
fileData = fileData.replace('exitChick = false', 'exitChild = true')
79+
fileData = fileData.replace('exitChild = false', 'exitChild = true')
7980
}
8081
if (options['ignore'] !== undefined) {
8182
var ignore = options['ignore']

lib/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ module.exports = function(script, scriptArgs, nodeArgs, opts) {
6262
terminal: false
6363
})
6464
rl.on('line', function(line) {
65+
console.log('rl.on line', line)
6566
if (line.trim() === 'rs') {
66-
log.debug('User entered `rs`')
6767
restart('', true)
6868
}
6969
})
@@ -187,8 +187,8 @@ module.exports = function(script, scriptArgs, nodeArgs, opts) {
187187
compiler.init(opts)
188188
}
189189
/* eslint-disable no-octal-escape */
190-
if (cfg.clear) process.stdout.write('\033[2J\033[H')
191-
if (isManualRestart) {
190+
if (cfg.clear) process.stdout.write('\033[2J\033[H')
191+
if (isManualRestart === true) {
192192
notify('Restarting', 'manual restart from user')
193193
} else {
194194
notify('Restarting', file + ' has been modified')

0 commit comments

Comments
 (0)