(private currentVersion: string)
| 233 | private args?: DefaultedArgs |
| 234 | |
| 235 | public constructor(private currentVersion: string) { |
| 236 | super() |
| 237 | |
| 238 | process.on("SIGUSR1", async () => { |
| 239 | this.logger.info("Received SIGUSR1; hotswapping") |
| 240 | this.relaunch() |
| 241 | }) |
| 242 | |
| 243 | process.on("SIGUSR2", async () => { |
| 244 | this.logger.info("Received SIGUSR2; hotswapping") |
| 245 | this.relaunch() |
| 246 | }) |
| 247 | |
| 248 | const opts = { |
| 249 | size: "10M", |
| 250 | maxFiles: 10, |
| 251 | path: path.join(paths.data, "coder-logs"), |
| 252 | } |
| 253 | this.logStdoutStream = rfs.createStream("code-server-stdout.log", opts) |
| 254 | this.logStderrStream = rfs.createStream("code-server-stderr.log", opts) |
| 255 | |
| 256 | this.onDispose(() => this.disposeChild()) |
| 257 | |
| 258 | this.onChildMessage((message) => { |
| 259 | switch (message.type) { |
| 260 | case "relaunch": |
| 261 | this.logger.info(`Relaunching: ${this.currentVersion} -> ${message.version}`) |
| 262 | this.currentVersion = message.version |
| 263 | this.relaunch() |
| 264 | break |
| 265 | default: |
| 266 | this.logger.error(`Unrecognized message ${message}`) |
| 267 | break |
| 268 | } |
| 269 | }) |
| 270 | } |
| 271 | |
| 272 | private async disposeChild(): Promise<void> { |
| 273 | this.started = undefined |
nothing calls this directly
no test coverage detected