diff options
Diffstat (limited to 'editors')
-rw-r--r-- | editors/code/src/installation/extension.ts | 2 | ||||
-rw-r--r-- | editors/code/src/installation/server.ts | 9 |
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 | */ |
102 | const tryDownloadNightlyExtension = notReentrant(async function tryDownloadNightlyExtension( | 102 | const 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"; | |||
5 | import { ArtifactSource } from "./interfaces"; | 5 | import { ArtifactSource } from "./interfaces"; |
6 | import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; | 6 | import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; |
7 | import { downloadArtifactWithProgressUi } from "./downloads"; | 7 | import { downloadArtifactWithProgressUi } from "./downloads"; |
8 | import { log, assert } from "../util"; | 8 | import { log, assert, notReentrant } from "../util"; |
9 | import { Config, NIGHTLY_TAG } from "../config"; | 9 | import { Config, NIGHTLY_TAG } from "../config"; |
10 | 10 | ||
11 | export async function ensureServerBinary(config: Config): Promise<null | string> { | 11 | export 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 | ||
85 | async function downloadServer( | 85 | /** |
86 | * Enforcing no reentrancy for this is best-effort. | ||
87 | */ | ||
88 | const 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 | ||
117 | function isBinaryAvailable(binaryPath: string): boolean { | 120 | function isBinaryAvailable(binaryPath: string): boolean { |
118 | const res = spawnSync(binaryPath, ["--version"]); | 121 | const res = spawnSync(binaryPath, ["--version"]); |