-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cluster, net: fix listen pipe with readable and writable in cluster
PR-URL: #43634 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
- Loading branch information
Showing
3 changed files
with
50 additions
and
7 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
29 changes: 29 additions & 0 deletions
29
test/parallel/test-cluster-listen-pipe-readable-writable.js
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,29 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
|
||
if (common.isWindows) { | ||
common.skip('skip on Windows'); | ||
return; | ||
} | ||
|
||
const assert = require('assert'); | ||
const cluster = require('cluster'); | ||
const net = require('net'); | ||
const fs = require('fs'); | ||
|
||
if (cluster.isPrimary) { | ||
cluster.fork(); | ||
} else { | ||
const tmpdir = require('../common/tmpdir'); | ||
tmpdir.refresh(); | ||
const server = net.createServer().listen({ | ||
path: common.PIPE, | ||
readableAll: true, | ||
writableAll: true, | ||
}, common.mustCall(() => { | ||
const stat = fs.statSync(common.PIPE); | ||
assert.strictEqual(stat.mode & 0o777, 0o777); | ||
server.close(); | ||
process.disconnect(); | ||
})); | ||
} |