Skip to content

Commit 47e71eb

Browse files
author
Taras Mankovski
committed
Fix Windows EPIPE errors on stdin during process cleanup
Add error handler on stdin stream to suppress EPIPE errors that occur when the child process exits before we finish writing to it. This is expected during cleanup when killing processes on Windows.
1 parent 277233b commit 47e71eb

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

process/src/exec/win32.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,15 @@ export const createWin32Process: CreateOSProcess = (command, options) => {
123123
return status;
124124
}
125125

126+
// Suppress EPIPE errors on stdin - these occur on Windows when the child
127+
// process exits before we finish writing to it. This is expected during
128+
// cleanup when we're killing the process.
129+
childProcess.stdin.on("error", (err: Error & { code?: string }) => {
130+
if (err.code !== "EPIPE") {
131+
throw err;
132+
}
133+
});
134+
126135
try {
127136
yield* provide({
128137
pid: pid as number,

0 commit comments

Comments
 (0)