about summary refs log tree commit diff
path: root/editors/code/src
diff options
context:
space:
mode:
authorVeetaha <gerzoh1@gmail.com>2020-03-14 02:01:28 +0200
committerVeetaha <gerzoh1@gmail.com>2020-03-14 02:01:46 +0200
commitd7b46e0527cd7b52845f37cffc57cbae4ba0b945 (patch)
treeb00b65495dd255bcc7376abd13eeed035cdd9ac2 /editors/code/src
parent7f02d4657b796a438e441e107d4fb1906ec1ed7b (diff)
downloadrust-d7b46e0527cd7b52845f37cffc57cbae4ba0b945.tar.gz
rust-d7b46e0527cd7b52845f37cffc57cbae4ba0b945.zip
vscode-postrefactor: enforcing more reentrancy
Diffstat (limited to 'editors/code/src')
-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 2022d090d3e..f6dd20d82d1 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 = "")
  *
  * ACHTUNG!: this function has a crazy amount of state transitions, handling errors during
  * each of them would result in a ton of code (especially accounting for cross-process
- * shared mutable `globalState` access). Enforcing reentrancy for this is best-effort.
+ * shared mutable `globalState` access). Enforcing no reentrancy for this is best-effort.
  */
 const tryDownloadNightlyExtension = notReentrant(async function tryDownloadNightlyExtension(
     config: Config,
diff --git a/editors/code/src/installation/server.ts b/editors/code/src/installation/server.ts
index 345f30d4763..f359584744b 100644
--- a/editors/code/src/installation/server.ts
+++ b/editors/code/src/installation/server.ts
@@ -5,7 +5,7 @@ import { spawnSync } from "child_process";
 import { ArtifactSource } from "./interfaces";
 import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info";
 import { downloadArtifactWithProgressUi } from "./downloads";
-import { log, assert } from "../util";
+import { log, assert, notReentrant } from "../util";
 import { Config, NIGHTLY_TAG } from "../config";
 
 export async function ensureServerBinary(config: Config): Promise<null | string> {
@@ -82,7 +82,10 @@ function shouldDownloadServer(
     return installed.date.getTime() !== required.date.getTime();
 }
 
-async function downloadServer(
+/**
+ * Enforcing no reentrancy for this is best-effort.
+ */
+const downloadServer = notReentrant(async function downloadServer(
     source: ArtifactSource.GithubRelease,
     config: Config,
 ): Promise<null | string> {
@@ -112,7 +115,7 @@ async function downloadServer(
     );
 
     return binaryPath;
-}
+});
 
 function isBinaryAvailable(binaryPath: string): boolean {
     const res = spawnSync(binaryPath, ["--version"]);