mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
a1040f2065
common.PIPE resides in the temp directory (except on Windows). Insure that the temp directory is refreshed in tests that use common.PIPE. PR-URL: https://github.com/nodejs/node/pull/3231 Fixes: https://github.com/nodejs/node/issues/3227 Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
42 lines
780 B
JavaScript
42 lines
780 B
JavaScript
'use strict';
|
|
// see https://github.com/joyent/node/issues/3257
|
|
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
var http = require('http');
|
|
|
|
var server = http.createServer(function(req, res) {
|
|
req.resume();
|
|
req.once('end', function() {
|
|
res.writeHead(200);
|
|
res.end();
|
|
server.close();
|
|
});
|
|
});
|
|
|
|
common.refreshTmpDir();
|
|
|
|
server.listen(common.PIPE, function() {
|
|
var req = http.request({
|
|
socketPath: common.PIPE,
|
|
headers: {'Content-Length':'1'},
|
|
method: 'POST',
|
|
path: '/'
|
|
});
|
|
|
|
req.write('.');
|
|
|
|
sched(function() { req.end(); }, 5);
|
|
});
|
|
|
|
// schedule a callback after `ticks` event loop ticks
|
|
function sched(cb, ticks) {
|
|
function fn() {
|
|
if (--ticks)
|
|
setImmediate(fn);
|
|
else
|
|
cb();
|
|
}
|
|
setImmediate(fn);
|
|
}
|