(pid: number)
| 196 | } |
| 197 | |
| 198 | function putPidInDebugMode(pid: number): void { |
| 199 | try { |
| 200 | if (process.platform === 'win32') { |
| 201 | // regular node has an undocumented API function for forcing another node process into debug mode. |
| 202 | // (<any>process)._debugProcess(pid); |
| 203 | // But since we are running on Electron's node, process._debugProcess doesn't work (for unknown reasons). |
| 204 | // So we use a regular node instead: |
| 205 | const command = `node -e process._debugProcess(${pid})`; |
| 206 | execSync(command); |
| 207 | } else { |
| 208 | process.kill(pid, 'SIGUSR1'); |
| 209 | } |
| 210 | } catch (e) { |
| 211 | throw new Error( |
| 212 | localize( |
| 213 | 'cannot.enable.debug.mode.error', |
| 214 | "Attach to process: cannot enable debug mode for process '{0}' ({1}).", |
| 215 | pid, |
| 216 | e, |
| 217 | ), |
| 218 | ); |
| 219 | } |
| 220 | } |
no test coverage detected