-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using `tempy` to generate random temporary directories results in unix domain socket names that are too long (104 bytes is the max on Mac) which manifests itself as EADDRINUSE errors. So replace `tempy` with a simple alternative. Also expands the CI test matrix, adding Node.js 18 and Windows and Mac, to test platform differences in the handling of sockets.
- Loading branch information
Showing
8 changed files
with
53 additions
and
26 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
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
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,22 @@ | ||
'use strict' | ||
|
||
const tempy = require('tempy') | ||
const path = require('path') | ||
const crypto = require('crypto') | ||
const fs = require('fs') | ||
|
||
exports.directory = function () { | ||
if (process.platform === 'darwin') { | ||
// With tempy we'd get a directory like: | ||
// /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/2548920d4cad0629af0e283f78636f1f | ||
// | ||
// Add to that the 'rave-level.sock' filename and the total length is 105 bytes, | ||
// while the maximum length of a unix domain socket on Mac is 104 bytes. Exceeding | ||
// it can result in EADDRINUSE errors. | ||
const dir = path.join('/tmp', crypto.randomBytes(10).toString('hex')) | ||
fs.mkdirSync(dir) | ||
return dir | ||
} else { | ||
return tempy.directory() | ||
} | ||
} |