Skip to content

Commit ef90fff

Browse files
author
Staffan Eketorp
committed
Reworked and documented option exitChild to dontExitChild. The existing behavior changed old behavior, and seems very unusual/. Reversed defaults
1 parent 7b59080 commit ef90fff

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ tsnd --respawn server.ts
3939
- `--prefer-ts` (default: false) - for each `.js` file (that is not in `node_modules`) will try to check if corresponding `.ts` version exists and require it.
4040
- `--ignore-watch` (default: []) - files/folders to be [ignored by `node-dev`](https://github.com/fgnass/node-dev#ignore-paths). **But also this behaviour enhanced:** it will also make up `new RegExp` of passed ignore string and check absolute paths of required files for match.
4141
So, to ignore everything in `node_modules`, just pass `--ignore-watch node_modules`.
42-
4342
- `--debug` - Some additional debug output.
4443
- `--interval` - Polling interval (ms)
4544
- `--debounce` - Debounce file change events (ms, non-polling mode)
4645
- `--clear` (`--cls`) Will clear screen on restart
4746
- `--watch` - Explicitly add files or folders to watch and restart on change (list separated by commas)
47+
- `--dont-exit-child` - Don't exit the child process on changes/SIGTERM
4848

4949
**Caveats and points of notice:**
5050

bin/ts-node-dev

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var opts = minimist(devArgs, {
3333
'prefer-ts-exts',
3434
'tree-kill',
3535
'clear', 'cls',
36-
'exit-child',
36+
'dont-exit-child',
3737
'rs'
3838
],
3939
string: [

lib/child-require-hook.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var preferTs = false
1111
var ignore = [/node_modules/]
1212
var readyFile
1313
var execCheck = false
14-
var exitChild = false
14+
var dontExitChild = false
1515
var sourceMapSupportPath
1616

1717
var checkFileScript = join(__dirname, 'check-file-exists.js')
@@ -114,6 +114,7 @@ if (readyFile) {
114114
}
115115

116116
if (exitChild) {
117+
if (!dontExitChild) {
117118
process.on('SIGTERM', function() {
118119
// This is to make sure debuggers (e.g. Chrome) close
119120
console.log('Child got SIGTERM, exiting.')

lib/compiler.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ var compiler = {
7575
fileData = fileData.replace('execCheck = false', 'execCheck = true')
7676
}
7777
if (options['exit-child']) {
78-
fileData = fileData.replace('exitChick = false', 'exitChild = true')
78+
if (options['dont-exit-child']) {
79+
fileData = fileData.replace('dontExitChild = false', 'dontExitChild = true')
7980
}
8081
if (options['ignore'] !== undefined) {
8182
var ignore = options['ignore']

0 commit comments

Comments
 (0)