Change net workaround for node 20

This commit is contained in:
Cohee 2023-09-10 18:22:39 +03:00
parent 70071312d3
commit d17ac770e6
1 changed files with 7 additions and 2 deletions

View File

@ -94,8 +94,13 @@ function createDefaultFiles() {
}
const net = require("net");
// @ts-ignore work around a node v20 bug: https://github.com/nodejs/node/issues/47822#issuecomment-1564708870
if (net.setDefaultAutoSelectFamily) net.setDefaultAutoSelectFamily(false);
// Work around a node v20.0.0, v20.1.0, and v20.2.0 bug. The issue was fixed in v20.3.0.
// https://github.com/nodejs/node/issues/47822#issuecomment-1564708870
// Safe to remove once support for Node v20 is dropped.
if (process.versions && process.versions.node && process.versions.node.match(/20\.[0-2]\.0/)) {
// @ts-ignore
if (net.setDefaultAutoSelectFamily) net.setDefaultAutoSelectFamily(false);
}
const cliArguments = yargs(hideBin(process.argv))
.option('disableCsrf', {