| 53 | } |
| 54 | |
| 55 | public async initialize(): Promise<void> { |
| 56 | for (const event of ["SIGINT", "SIGTERM"]) { |
| 57 | process.on(event, () => this.dispose(0)) |
| 58 | } |
| 59 | |
| 60 | for (const [processName, devProcess] of Object.entries(this.compilers)) { |
| 61 | if (!devProcess) continue |
| 62 | |
| 63 | devProcess.on("exit", (code) => { |
| 64 | console.log(`[${processName}]`, "Terminated unexpectedly") |
| 65 | this.dispose(code) |
| 66 | }) |
| 67 | |
| 68 | if (devProcess.stderr) { |
| 69 | devProcess.stderr.on("data", (d: string | Uint8Array) => process.stderr.write(d)) |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | onLine(this.compilers.vscode, this.parseVSCodeLine) |
| 74 | onLine(this.compilers.codeServer, this.parseCodeServerLine) |
| 75 | |
| 76 | if (this.compilers.plugins) { |
| 77 | onLine(this.compilers.plugins, this.parsePluginLine) |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | //#endregion |
| 82 | |