test(subprocess): close control endpoint after the write callback

This commit is contained in:
Tianyi Cui committed 2026-09-12 15:03:00 +08:00
1 parent b9dfb8da1c
commit 3ccb898cd5
2 files changed
+2 -2

No files matched your search

@@ -37,7 +37,7 @@ describe.skipIf(process.platform !== 'win32')('managed Windows ACL control pipe'
const chunks = []; let received = 0;
channel.on('data', chunk => {
chunks.push(chunk); received += chunk.length;
if (received === 262144) channel.end(Buffer.concat(chunks), () => channel.destroy());
if (received === 262144) channel.write(Buffer.concat(chunks), () => channel.destroy());
});
`
const handle = ctx.subprocess.spawn({
@@ -16,6 +16,6 @@ channel.on('data', (chunk: Buffer) => {
received += chunk.length
if (received === size) {
channel.removeAllListeners('data')
channel.end(Buffer.concat(chunks), () => { channel.destroy() })
channel.write(Buffer.concat(chunks), () => { channel.destroy() })
}
})