mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
28c7394319
PR-URL: https://github.com/nodejs/node/pull/55063 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const net = require('net');
|
|
const fs = require('fs');
|
|
const tmpdir = require('../common/tmpdir');
|
|
tmpdir.refresh();
|
|
|
|
// Test UV_PIPE_NO_TRUNCATE
|
|
|
|
// See pipe_overlong_path in https://github.com/libuv/libuv/blob/master/test/test-pipe-bind-error.c
|
|
if (common.isWindows) {
|
|
common.skip('UV_PIPE_NO_TRUNCATE is not supported on window');
|
|
}
|
|
|
|
// See https://github.com/libuv/libuv/issues/4231
|
|
const pipePath = `${tmpdir.path}/${'x'.repeat(10000)}.sock`;
|
|
|
|
const server = net.createServer()
|
|
.listen(pipePath)
|
|
// It may work on some operating systems
|
|
.on('listening', () => {
|
|
// The socket file must exist
|
|
assert.ok(fs.existsSync(pipePath));
|
|
const socket = net.connect(pipePath, common.mustCall(() => {
|
|
socket.destroy();
|
|
server.close();
|
|
}));
|
|
})
|
|
.on('error', (error) => {
|
|
assert.ok(error.code === 'EINVAL', error.message);
|
|
net.connect(pipePath)
|
|
.on('error', common.mustCall((error) => {
|
|
assert.ok(error.code === 'EINVAL', error.message);
|
|
}));
|
|
});
|