diff options
Diffstat (limited to 'editors/code/src/installation/server.ts')
-rw-r--r-- | editors/code/src/installation/server.ts | 9 |
1 files changed, 6 insertions, 3 deletions
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"]); |