summaryrefslogtreecommitdiff
path: root/test/parallel/test-tls-wrap-econnreset-pipe.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-tls-wrap-econnreset-pipe.js')
-rw-r--r--test/parallel/test-tls-wrap-econnreset-pipe.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/test/parallel/test-tls-wrap-econnreset-pipe.js b/test/parallel/test-tls-wrap-econnreset-pipe.js
index b400e35d41..a5cba7e47b 100644
--- a/test/parallel/test-tls-wrap-econnreset-pipe.js
+++ b/test/parallel/test-tls-wrap-econnreset-pipe.js
@@ -7,10 +7,27 @@ if (!common.hasCrypto)
const assert = require('assert');
const tls = require('tls');
const net = require('net');
+const { fork } = require('child_process');
const tmpdir = require('../common/tmpdir');
-tmpdir.refresh();
+// Run in a child process because the PIPE file descriptor stays open until
+// Node.js completes, blocking the tmpdir and preventing cleanup.
+
+if (process.argv[2] !== 'child') {
+ // Parent
+ tmpdir.refresh();
+
+ // Run test
+ const child = fork(__filename, ['child'], { stdio: 'inherit' });
+ child.on('exit', common.mustCall(function(code) {
+ assert.strictEqual(code, 0);
+ }));
+
+ return;
+}
+
+// Child
const server = net.createServer((c) => {
c.end();
}).listen(common.PIPE, common.mustCall(() => {