(session: ProcessSession, input: StartCommandInput)
| 317 | } |
| 318 | |
| 319 | private startPipe(session: ProcessSession, input: StartCommandInput): void { |
| 320 | const shell = resolveShellCommand(input.command); |
| 321 | const detached = process.platform !== "win32"; |
| 322 | const child = spawn(input.command, { |
| 323 | cwd: input.cwd, |
| 324 | env: processEnvironment(), |
| 325 | stdio: "pipe", |
| 326 | windowsHide: true, |
| 327 | detached, |
| 328 | shell: shell.executable, |
| 329 | }); |
| 330 | |
| 331 | session.process = { |
| 332 | write: (data) => child.stdin.write(data), |
| 333 | kill: (signal = "SIGTERM") => terminateProcessTree(child, signal, detached), |
| 334 | resize: input.tty ? () => undefined : undefined, |
| 335 | }; |
| 336 | child.stdout.on("data", (data: Buffer) => this.append(session, data.toString("utf8"))); |
| 337 | child.stderr.on("data", (data: Buffer) => this.append(session, data.toString("utf8"))); |
| 338 | child.on("error", (error) => this.append(session, `${error.message}\n`)); |
| 339 | child.on("close", (code, signal) => this.finish(session, code ?? undefined, signal ?? undefined)); |
| 340 | } |
| 341 | |
| 342 | private async startPty(session: ProcessSession, input: StartCommandInput): Promise<void> { |
| 343 | let nodePty: typeof import("node-pty"); |
no test coverage detected