| 28 | const SHELL_PROCESS_ID_TIMEOUT = 1000; |
| 29 | |
| 30 | class VSCodeTerminalProcess implements IProgram { |
| 31 | public readonly stopped: Promise<IStopMetadata>; |
| 32 | |
| 33 | constructor(private readonly terminal: vscode.Terminal) { |
| 34 | this.stopped = new Promise(resolve => { |
| 35 | const disposable = vscode.window.onDidCloseTerminal(t => { |
| 36 | if (t === terminal) { |
| 37 | resolve({ code: 0, killed: true }); |
| 38 | disposable.dispose(); |
| 39 | } |
| 40 | }); |
| 41 | }); |
| 42 | } |
| 43 | |
| 44 | public gotTelemetery() { |
| 45 | // no-op |
| 46 | } |
| 47 | |
| 48 | public stop() { |
| 49 | // send ctrl+c to sigint any running processs (vscode/#108289) |
| 50 | this.terminal.sendText('\x03'); |
| 51 | // and then destroy it on the next event loop tick |
| 52 | setTimeout(() => this.terminal.dispose(), 1); |
| 53 | |
| 54 | return this.stopped; |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | export interface ITerminalLauncherLike extends NodeLauncherBase<ITerminalLaunchConfiguration> { |
| 59 | /** |
nothing calls this directly
no outgoing calls
no test coverage detected