Version
v21.7.1
Platform
Linux my-laptop 6.5.0-26-generic #26-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 5 21:19:28 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
child_process
What steps will reproduce the bug?
With print.js:
import {writeSync} from 'node:fs'
const fdNumber = Number(process.argv[2])
writeSync(fdNumber, 'oo') // 2 bytes, above the `maxBuffer: 1` threshold below
Then example.js:
import {spawnSync} from 'node:child_process'
const {error, output} = spawnSync('node', ['./print.js', '3'], {
maxBuffer: 1,
stdio: ['pipe', 'pipe', 'pipe', 'ignore'],
})
console.log(error) // ENOBUFS
console.log(output[3]) // null
How often does it reproduce? Is there a required condition?
No.
What is the expected behavior? Why is that the expected behavior?
Since stdio[3] is ignore, the maxBuffer option should not apply to it. I.e. the ENOBUFS error should not be present. For example, this is what happens with stdio[2].
const {error, output} = spawnSync('node', ['./print.js', '2'], {
maxBuffer: 1,
stdio: ['pipe', 'pipe', 'ignore'],
})
console.log(error) // undefined
console.log(output[2]) // null
What do you see instead?
The ENOBUFS error is present.
Additional information
No response
Version
v21.7.1
Platform
Linux my-laptop 6.5.0-26-generic #26-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 5 21:19:28 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
child_process
What steps will reproduce the bug?
With
print.js:Then
example.js:How often does it reproduce? Is there a required condition?
No.
What is the expected behavior? Why is that the expected behavior?
Since
stdio[3]isignore, themaxBufferoption should not apply to it. I.e. theENOBUFSerror should not be present. For example, this is what happens withstdio[2].What do you see instead?
The
ENOBUFSerror is present.Additional information
No response