mirror of
https://github.com/nodejs/node.git
synced 2025-05-21 15:44:52 +00:00

Expose `common.refreshTmpDir()` and only call it for tests that use common.tmpDir or common.PIPE. A positive side effect is the removal of a code smell where child processes were detected by the presence of `.send()`. Now each process can decide for itself if it needs to refresh tmpDir. PR-URL: https://github.com/nodejs/io.js/pull/1954 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
19 lines
418 B
JavaScript
19 lines
418 B
JavaScript
// child process that listens on a socket, allows testing of an EADDRINUSE condition
|
|
|
|
var common = require('../common');
|
|
var net = require('net');
|
|
|
|
common.refreshTmpDir();
|
|
|
|
var server = net.createServer().listen(common.PIPE, function() {
|
|
console.log('child listening');
|
|
process.send('listening');
|
|
});
|
|
|
|
function onmessage() {
|
|
console.log('child exiting');
|
|
server.close();
|
|
}
|
|
|
|
process.once('message', onmessage);
|