Skip to content

Commit 5cc83f7

Browse files
authored
cli: verify vscode server integrity before committing to cache (microsoft#191792)
Fixes microsoft#191469
1 parent ec9aa5c commit 5cc83f7

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

cli/src/tunnels/code_server.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::tunnels::paths::{get_server_folder_name, SERVER_FOLDER_NAME};
1414
use crate::update_service::{
1515
unzip_downloaded_release, Platform, Release, TargetKind, UpdateService,
1616
};
17-
use crate::util::command::{capture_command, kill_tree};
17+
use crate::util::command::{capture_command, capture_command_and_check_status, kill_tree};
1818
use crate::util::errors::{wrap, AnyError, CodeError, ExtensionInstallFailed, WrappedError};
1919
use crate::util::http::{self, BoxedHttp};
2020
use crate::util::io::SilentCopyProgress;
@@ -416,11 +416,23 @@ impl<'a> ServerBuilder<'a> {
416416
)
417417
.await?;
418418

419-
unzip_downloaded_release(
420-
&archive_path,
421-
&target_dir.join(SERVER_FOLDER_NAME),
422-
SilentCopyProgress(),
423-
)?;
419+
let server_dir = target_dir.join(SERVER_FOLDER_NAME);
420+
unzip_downloaded_release(&archive_path, &server_dir, SilentCopyProgress())?;
421+
422+
let output = capture_command_and_check_status(
423+
server_dir
424+
.join("bin")
425+
.join(self.server_params.release.quality.server_entrypoint()),
426+
&["--version"],
427+
)
428+
.await
429+
.map_err(|e| wrap(e, "error checking server integrity"))?;
430+
431+
trace!(
432+
self.logger,
433+
"Server integrity verified, version: {}",
434+
String::from_utf8_lossy(&output.stdout).replace('\n', " / ")
435+
);
424436

425437
Ok(())
426438
})

0 commit comments

Comments
 (0)