Skip to content

Commit a38ce0f

Browse files
committed
feat: support restartOnExit option
1 parent 8fd6b7f commit a38ce0f

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ launch({
4444
// instead of restarting the process.
4545
'src/server/ssr/serverSideRender.js',
4646
],
47+
restartOnError: true, // optional, restart when child process has an uncaught error/promise rejection (default: true)
48+
restartOnExit: true, // optional, restart when child process exits (default: true)
4749
})
4850
```
4951

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ module.exports = function launch(ops) {
2727
includeModules: false,
2828
ignore: /(\/\.|~$)/,
2929
restartOnError: true,
30+
restartOnExit: true,
3031
killSignal: 'SIGINT',
3132
command: process.argv[0],
3233
commandOptions: [],
@@ -58,7 +59,7 @@ module.exports = function launch(ops) {
5859
}
5960

6061
childRunning = false
61-
restart()
62+
if (options.restartOnExit) restart()
6263
}
6364

6465
function restart() {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "smart-restart",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "Like nodemon but only watches require()d files. Like piping but easy to use with node-inspector.",
55
"engines": {
66
"node": ">=8"

0 commit comments

Comments
 (0)