-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: add UV_PIPE_NO_TRUNCATE for bind in pipe_wrap.cc
PR-URL: #52347 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
- Loading branch information
Showing
3 changed files
with
49 additions
and
8 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
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'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 exsit | ||
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); | ||
})); | ||
}); |