Skip to content

Commit

Permalink
Polyfill os.hostname() on Windows 7
Browse files Browse the repository at this point in the history
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
  • Loading branch information
automated-signal and indutny-signal committed Jun 20, 2022
1 parent 4e92ea0 commit a27dee7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,16 @@ async function prepareUrl(
);
}

let hostname: string;

try {
// os.hostname() doesn't work on Windows 7 anymore
// See: https://github.com/electron/electron/issues/34404
hostname = os.hostname();
} catch {
hostname = 'Desktop';
}

const urlParams: RendererConfigType = {
name: packageJson.productName,
locale: getLocale().name,
Expand All @@ -411,7 +421,7 @@ async function prepareUrl(
environment: enableCI ? Environment.Production : getEnvironment(),
enableCI,
nodeVersion: process.versions.node,
hostname: os.hostname(),
hostname,
appInstance: process.env.NODE_APP_INSTANCE || undefined,
proxyUrl: process.env.HTTPS_PROXY || process.env.https_proxy || undefined,
contentProxyUrl: config.get<string>('contentProxyUrl'),
Expand Down

0 comments on commit a27dee7

Please sign in to comment.