Browse Source

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

Tianyi Cui 1 tuần trước cách đây
mục cha
commit
3ccb898cd5

+ 1 - 1
packages/sandbox/sandbox-windows-acl/tests/control.spec.ts

@@ -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({

+ 1 - 1
packages/subprocess/subprocess-local/tests/fixtures/control-child.ts

@@ -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() })
   }
 })