MCPcopy
hub / github.com/di-sukharev/opencommit / pipeToTarget

Function pipeToTarget

out/cli.cjs:66588–66605  ·  view source on GitHub ↗
(spawned, streamName, target)

Source from the content-addressed store, hash-verified

66586 return stream4 !== null && typeof stream4 === "object" && typeof stream4.pipe === "function";
66587}
66588function isWritableStream(stream4) {
66589 return isStream(stream4) && stream4.writable !== false && typeof stream4._write === "function" && typeof stream4._writableState === "object";
66590}
66591
66592// node_modules/execa/lib/pipe.js
66593var isExecaChildProcess = (target) => target instanceof import_node_child_process.ChildProcess && typeof target.then === "function";
66594var pipeToTarget = (spawned, streamName, target) => {
66595 if (typeof target === "string") {
66596 spawned[streamName].pipe((0, import_node_fs.createWriteStream)(target));
66597 return spawned;
66598 }
66599 if (isWritableStream(target)) {
66600 spawned[streamName].pipe(target);
66601 return spawned;
66602 }
66603 if (!isExecaChildProcess(target)) {
66604 throw new TypeError("The second argument must be a string, a stream or an Execa child process.");
66605 }
66606 if (!isWritableStream(target.stdin)) {
66607 throw new TypeError("The target child process's stdin must be available.");
66608 }

Callers

nothing calls this directly

Calls 3

isWritableStreamFunction · 0.85
isExecaChildProcessFunction · 0.85
pipeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…