MCPcopy Index your code
hub / github.com/Waishnav/devspace / startPipe

Method startPipe

src/process-sessions.ts:319–340  ·  view source on GitHub ↗
(session: ProcessSession, input: StartCommandInput)

Source from the content-addressed store, hash-verified

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");

Callers 1

startMethod · 0.95

Calls 6

appendMethod · 0.95
finishMethod · 0.95
resolveShellCommandFunction · 0.85
processEnvironmentFunction · 0.85
terminateProcessTreeFunction · 0.85
writeMethod · 0.65

Tested by

no test coverage detected