You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 224dd20
Browse filesBrowse the repository at this point in the historyBrowse files
Fix zero maxBuffer allowing unbounded synchronous output
`maxBuffer: 0` disables the limit of `child_process.spawnSync()`, so the subprocess' output was never limited. A zero value must reject the first byte, like it does with asynchronous methods.
// The native `maxBuffer` option passed to `spawnSync()` does not allow differentiating values per file descriptor, so we use `stdout`'s.
64
64
// Since each other file descriptor's own limit is capped by `stdout`'s, this is also the highest one.
65
65
// Node.js applies it to the total output of all piped file descriptors, not to each of them. When it is hit, the subprocess is killed and a `ENOBUFS` error is thrown.
// These tests need the subprocess to have written its output before the timeout kills it, which is only guaranteed if the timeout leaves room for the subprocess to start. On a busy machine, starting Node.js can take over a second.
370
370
constSYNC_TIMEOUT=1e4;
371
371
372
+
test('maxBuffer 0 terminates on the first output byte before timeout, sync',()=>{
// A file descriptor limit lower than `maxBuffer.stdout` does not stop the subprocess with synchronous methods, so the subprocess can still time out afterwards
0 commit comments