MCPcopy Create free account
hub / github.com/Snapchat/Valdi / putPidInDebugMode

Function putPidInDebugMode

valdi/vscode_debugger/src/ui/processPicker.ts:198–220  ·  view source on GitHub ↗
(pid: number)

Source from the content-addressed store, hash-verified

196}
197
198function 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}

Callers 1

resolveProcessIdFunction · 0.85

Calls 1

killMethod · 0.65

Tested by

no test coverage detected