mirror of
https://github.com/nodejs/node.git
synced 2025-05-10 20:59:42 +00:00

Move tmpdir functionality to its own module (common/tmpdir). PR-URL: https://github.com/nodejs/node/pull/17856 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
38 lines
830 B
JavaScript
38 lines
830 B
JavaScript
'use strict';
|
|
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
const { fork } = require('child_process');
|
|
const common = require('../common.js');
|
|
const { PIPE } = require('../../test/common');
|
|
const tmpdir = require('../../test/common/tmpdir');
|
|
process.env.PIPE_NAME = PIPE;
|
|
|
|
tmpdir.refresh();
|
|
|
|
var server;
|
|
|
|
server = http.createServer(function(req, res) {
|
|
const headers = {
|
|
'content-type': 'text/plain',
|
|
'content-length': '2'
|
|
};
|
|
res.writeHead(200, headers);
|
|
res.end('ok');
|
|
});
|
|
|
|
server.on('error', function(err) {
|
|
throw new Error(`server error: ${err}`);
|
|
});
|
|
server.listen(PIPE);
|
|
|
|
const child = fork(
|
|
`${__dirname}/_chunky_http_client.js`,
|
|
process.argv.slice(2)
|
|
);
|
|
child.on('message', common.sendResult);
|
|
child.on('close', function(code) {
|
|
server.close();
|
|
assert.strictEqual(code, 0);
|
|
});
|