Skip to content

Commit f5442d1

Browse files
authored
cli: skip integrity check when prereq skip flag is present (#203912) (#203931)
1 parent 0504748 commit f5442d1

File tree

2 files changed

+30
-19
lines changed

2 files changed

+30
-19
lines changed

cli/src/tunnels/code_server.rs

+19-14
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use crate::util::errors::{wrap, AnyError, CodeError, ExtensionInstallFailed, Wra
2121
use crate::util::http::{self, BoxedHttp};
2222
use crate::util::io::SilentCopyProgress;
2323
use crate::util::machine::process_exists;
24+
use crate::util::prereqs::skip_requirements_check;
2425
use crate::{debug, info, log, spanf, trace, warning};
2526
use lazy_static::lazy_static;
2627
use opentelemetry::KeyValue;
@@ -425,20 +426,24 @@ impl<'a> ServerBuilder<'a> {
425426
let server_dir = target_dir.join(SERVER_FOLDER_NAME);
426427
unzip_downloaded_release(&archive_path, &server_dir, SilentCopyProgress())?;
427428

428-
let output = capture_command_and_check_status(
429-
server_dir
430-
.join("bin")
431-
.join(self.server_params.release.quality.server_entrypoint()),
432-
&["--version"],
433-
)
434-
.await
435-
.map_err(|e| wrap(e, "error checking server integrity"))?;
436-
437-
trace!(
438-
self.logger,
439-
"Server integrity verified, version: {}",
440-
String::from_utf8_lossy(&output.stdout).replace('\n', " / ")
441-
);
429+
if !skip_requirements_check().await {
430+
let output = capture_command_and_check_status(
431+
server_dir
432+
.join("bin")
433+
.join(self.server_params.release.quality.server_entrypoint()),
434+
&["--version"],
435+
)
436+
.await
437+
.map_err(|e| wrap(e, "error checking server integrity"))?;
438+
439+
trace!(
440+
self.logger,
441+
"Server integrity verified, version: {}",
442+
String::from_utf8_lossy(&output.stdout).replace('\n', " / ")
443+
);
444+
} else {
445+
info!(self.logger, "Skipping server integrity check");
446+
}
442447

443448
Ok(())
444449
})

cli/src/util/prereqs.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ lazy_static! {
2525
}
2626

2727
const NIXOS_TEST_PATH: &str = "/etc/NIXOS";
28-
const SKIP_REQ_FILE: &str = "/tmp/vscode-skip-server-requirements-check";
2928

3029
pub struct PreReqChecker {}
3130

@@ -55,7 +54,7 @@ impl PreReqChecker {
5554
pub async fn verify(&self) -> Result<Platform, CodeError> {
5655
let (is_nixos, skip_glibc_checks, or_musl) = tokio::join!(
5756
check_is_nixos(),
58-
check_skip_req_file(),
57+
skip_requirements_check(),
5958
check_musl_interpreter()
6059
);
6160

@@ -169,9 +168,16 @@ async fn check_is_nixos() -> bool {
169168
/// Provides a way to skip the server glibc requirements check from
170169
/// outside the install flow. A system process can create this
171170
/// file before the server is downloaded and installed.
172-
#[allow(dead_code)]
173-
async fn check_skip_req_file() -> bool {
174-
fs::metadata(SKIP_REQ_FILE).await.is_ok()
171+
#[cfg(not(windows))]
172+
pub async fn skip_requirements_check() -> bool {
173+
fs::metadata("/tmp/vscode-skip-server-requirements-check")
174+
.await
175+
.is_ok()
176+
}
177+
178+
#[cfg(windows)]
179+
pub async fn skip_requirements_check() -> bool {
180+
false
175181
}
176182

177183
#[allow(dead_code)]

0 commit comments

Comments
 (0)