本页还没有译文
本页 4 段还没译成Español,下面显示的是英文原文。Read stderr from a child process
还没翻译译自英文(bun.com)本页 4 段都还没译
When you spawn a child process with Bun.spawn(), it inherits the stderr of the spawning process. To read and handle stderr instead, set the stderr option to "pipe".
const proc = Bun.spawn(["echo", "hello"], {
stderr: "pipe",
});
proc.stderr; // => ReadableStreamTo read stderr until the child process exits, use .text().
const proc = Bun.spawn(["echo", "hello"], {
stderr: "pipe",
});
const errors: string = await proc.stderr.text();
if (errors) {
// handle errors
}See Child processes.
AI 翻译查看英文原文