Monkey-patch os.hostname on Windows 7

This commit is contained in:
Fedor Indutny 2022-06-23 12:15:27 -07:00 committed by GitHub
parent 82dad0d7f7
commit 96b864d6a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 51 additions and 17 deletions

View file

@ -0,0 +1,13 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import semver from 'semver';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const os = require('os');
// os.hostname() doesn't work on Windows 7 anymore
// See: https://github.com/electron/electron/issues/34404
if (process.platform === 'win32' && semver.satisfies(os.release(), '6.1.x')) {
os.hostname = () => 'Desktop';
}