From 4e93db5b955d899af880126d2ff76376f3dcf1aa Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 27 Apr 2022 10:10:48 -0500 Subject: [PATCH] feat: relaunch on SIGUSR2 (#4979) 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. --- src/node/wrapper.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/node/wrapper.ts b/src/node/wrapper.ts index c645fe835..42151ab1a 100644 --- a/src/node/wrapper.ts +++ b/src/node/wrapper.ts @@ -203,8 +203,9 @@ class ChildProcess extends Process { /** * Parent process wrapper that spawns the child process and performs a handshake - * with it. Will relaunch the child if it receives a SIGUSR1 or is asked to by - * the child. If the child otherwise exits the parent will also exit. + * with it. Will relaunch the child if it receives a SIGUSR1 or SIGUSR2 or is + * asked to by the child. If the child otherwise exits the parent will also + * exit. */ export class ParentProcess extends Process { public logger = logger.named(`parent:${process.pid}`) @@ -227,6 +228,11 @@ export class ParentProcess extends Process { this.relaunch() }) + process.on("SIGUSR2", async () => { + this.logger.info("Received SIGUSR2; hotswapping") + this.relaunch() + }) + const opts = { size: "10M", maxFiles: 10,