()
| 41 | } |
| 42 | |
| 43 | function restart() { |
| 44 | if (shuttingDown) return; |
| 45 | clearTimeout(restartTimer); |
| 46 | |
| 47 | if (!child) { |
| 48 | start(); |
| 49 | return; |
| 50 | } |
| 51 | |
| 52 | stoppingForRestart = true; |
| 53 | child.once("exit", () => { |
| 54 | if (!shuttingDown) start(); |
| 55 | }); |
| 56 | child.kill("SIGTERM"); |
| 57 | |
| 58 | setTimeout(() => { |
| 59 | if (child && stoppingForRestart) child.kill("SIGKILL"); |
| 60 | }, 3000).unref(); |
| 61 | } |
| 62 | |
| 63 | function watchDirectory(root) { |
| 64 | const watchers = []; |