aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code')
-rw-r--r--editors/code/src/installation/extension.ts2
-rw-r--r--editors/code/src/installation/server.ts9
2 files changed, 7 insertions, 4 deletions
diff --git a/editors/code/src/installation/extension.ts b/editors/code/src/installation/extension.ts
index 2022d090d..f6dd20d82 100644
--- a/editors/code/src/installation/extension.ts
+++ b/editors/code/src/installation/extension.ts
@@ -97,7 +97,7 @@ async function askToDownloadProperExtensionVersion(config: Config, reason = "")
97 * 97 *
98 * ACHTUNG!: this function has a crazy amount of state transitions, handling errors during 98 * ACHTUNG!: this function has a crazy amount of state transitions, handling errors during
99 * each of them would result in a ton of code (especially accounting for cross-process 99 * each of them would result in a ton of code (especially accounting for cross-process
100 * shared mutable `globalState` access). Enforcing reentrancy for this is best-effort. 100 * shared mutable `globalState` access). Enforcing no reentrancy for this is best-effort.
101 */ 101 */
102const tryDownloadNightlyExtension = notReentrant(async function tryDownloadNightlyExtension( 102const tryDownloadNightlyExtension = notReentrant(async function tryDownloadNightlyExtension(
103 config: Config, 103 config: Config,
diff --git a/editors/code/src/installation/server.ts b/editors/code/src/installation/server.ts
index 345f30d47..f35958474 100644
--- a/editors/code/src/installation/server.ts
+++ b/editors/code/src/installation/server.ts
@@ -5,7 +5,7 @@ import { spawnSync } from "child_process";
5import { ArtifactSource } from "./interfaces"; 5import { ArtifactSource } from "./interfaces";
6import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; 6import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info";
7import { downloadArtifactWithProgressUi } from "./downloads"; 7import { downloadArtifactWithProgressUi } from "./downloads";
8import { log, assert } from "../util"; 8import { log, assert, notReentrant } from "../util";
9import { Config, NIGHTLY_TAG } from "../config"; 9import { Config, NIGHTLY_TAG } from "../config";
10 10
11export async function ensureServerBinary(config: Config): Promise<null | string> { 11export async function ensureServerBinary(config: Config): Promise<null | string> {
@@ -82,7 +82,10 @@ function shouldDownloadServer(
82 return installed.date.getTime() !== required.date.getTime(); 82 return installed.date.getTime() !== required.date.getTime();
83} 83}
84 84
85async function downloadServer( 85/**
86 * Enforcing no reentrancy for this is best-effort.
87 */
88const downloadServer = notReentrant(async function downloadServer(
86 source: ArtifactSource.GithubRelease, 89 source: ArtifactSource.GithubRelease,
87 config: Config, 90 config: Config,
88): Promise<null | string> { 91): Promise<null | string> {
@@ -112,7 +115,7 @@ async function downloadServer(
112 ); 115 );
113 116
114 return binaryPath; 117 return binaryPath;
115} 118});
116 119
117function isBinaryAvailable(binaryPath: string): boolean { 120function isBinaryAvailable(binaryPath: string): boolean {
118 const res = spawnSync(binaryPath, ["--version"]); 121 const res = spawnSync(binaryPath, ["--version"]);