forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! test: clean tmpdir on process exit
Fixes for Linux open files
- Loading branch information
1 parent
3189416
commit 2367954
Showing
3 changed files
with
27 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,27 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const net = require('net'); | ||
const assert = require('assert'); | ||
const { fork } = require('child_process'); | ||
|
||
// This test should end immediately after `unref` is called | ||
// The pipe will stay open as Node.js completes, thus run in a child process | ||
// so that tmpdir can be cleaned up. | ||
|
||
const tmpdir = require('../common/tmpdir'); | ||
tmpdir.refresh(); | ||
|
||
const s = net.Server(); | ||
s.listen(common.PIPE); | ||
s.unref(); | ||
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); | ||
})); | ||
} else { | ||
// Child | ||
const s = net.Server(); | ||
s.listen(common.PIPE); | ||
s.unref(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters