11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciconst net = require('net'); 41cb0ef41Sopenharmony_ciconst assert = require('assert'); 51cb0ef41Sopenharmony_ciconst { fork } = require('child_process'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci// This test should end immediately after `unref` is called 81cb0ef41Sopenharmony_ci// The pipe will stay open as Node.js completes, thus run in a child process 91cb0ef41Sopenharmony_ci// so that tmpdir can be cleaned up. 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciconst tmpdir = require('../common/tmpdir'); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciif (process.argv[2] !== 'child') { 141cb0ef41Sopenharmony_ci // Parent 151cb0ef41Sopenharmony_ci tmpdir.refresh(); 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ci // Run test 181cb0ef41Sopenharmony_ci const child = fork(__filename, ['child'], { stdio: 'inherit' }); 191cb0ef41Sopenharmony_ci child.on('exit', common.mustCall(function(code) { 201cb0ef41Sopenharmony_ci assert.strictEqual(code, 0); 211cb0ef41Sopenharmony_ci })); 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ci return; 241cb0ef41Sopenharmony_ci} 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_ci// Child 271cb0ef41Sopenharmony_ciconst s = net.Server(); 281cb0ef41Sopenharmony_cis.listen(common.PIPE); 291cb0ef41Sopenharmony_cis.unref(); 30