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

Class SubprocessProgram

valdi/vscode_debugger/src/targets/valdi/program.ts:30–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28 * Program created from a subprocess.
29 */
30export class SubprocessProgram implements IProgram {
31 public readonly stopped: Promise<IStopMetadata>;
32 private killed = false;
33
34 constructor(private readonly child: ChildProcess, private readonly logger: ILogger) {
35 this.stopped = new Promise((resolve, reject) => {
36 child.once('exit', code => resolve({ killed: this.killed, code: code || 0 }));
37 child.once('error', error => reject({ killed: this.killed, code: 1, error }));
38 });
39 }
40
41 public gotTelemetery() {
42 // no-op
43 }
44
45 public stop(): Promise<IStopMetadata> {
46 this.killed = true;
47 killTree(this.child.pid, this.logger);
48 return this.stopped;
49 }
50}
51
52/**
53 * A no-op program that never stops until stop() is called. Currently, we use

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected