Skip to content

Commit 6e18898

Browse files
committed
Relaunch on SIGUSR2
This is because Node uses SIGUSR1 to enable the debug listener so even if you just want to restart code-server you end up enabling the debug listener as well. Opted to leave the SIGUSR1 handler in to avoid breaking existing workflows even though it does mean even if you only want to enable the debug listener you will end up restarting code-server as well. We could consider removing it after a transition phase.
1 parent 643ef13 commit 6e18898

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/node/wrapper.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,9 @@ class ChildProcess extends Process {
203203

204204
/**
205205
* Parent process wrapper that spawns the child process and performs a handshake
206-
* with it. Will relaunch the child if it receives a SIGUSR1 or is asked to by
207-
* the child. If the child otherwise exits the parent will also exit.
206+
* with it. Will relaunch the child if it receives a SIGUSR1 or SIGUSR2 or is
207+
* asked to by the child. If the child otherwise exits the parent will also
208+
* exit.
208209
*/
209210
export class ParentProcess extends Process {
210211
public logger = logger.named(`parent:${process.pid}`)
@@ -227,6 +228,11 @@ export class ParentProcess extends Process {
227228
this.relaunch()
228229
})
229230

231+
process.on("SIGUSR2", async () => {
232+
this.logger.info("Received SIGUSR2; hotswapping")
233+
this.relaunch()
234+
})
235+
230236
const opts = {
231237
size: "10M",
232238
maxFiles: 10,

0 commit comments

Comments
 (0)