fix integrated cli check

This commit is contained in:
Connor Peet 2022-10-17 13:49:50 -07:00
parent 4e9bdbd44f
commit b987cb47f4
No known key found for this signature in database
GPG key ID: CF8FD2EA0DBC61BD
2 changed files with 13 additions and 15 deletions

View file

@ -312,7 +312,7 @@ stages:
parameters:
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
VSCODE_BUILD_TUNNEL_CLI: true
VSCODE_BUILD_TUNNEL_CLI: ${{ parameters.VSCODE_BUILD_TUNNEL_CLI }}
VSCODE_RUN_UNIT_TESTS: ${{ eq(parameters.VSCODE_STEP_ON_IT, false) }}
VSCODE_RUN_INTEGRATION_TESTS: ${{ eq(parameters.VSCODE_STEP_ON_IT, false) }}
VSCODE_RUN_SMOKE_TESTS: ${{ eq(parameters.VSCODE_STEP_ON_IT, false) }}

View file

@ -5,27 +5,25 @@
use std::{env, io};
use crate::constants::VSCODE_CLI_QUALITY;
/// Gets whether the current CLI seems like it's running in integrated mode,
/// by looking at the location of the exe and known VS Code files.
pub fn is_integrated_cli() -> io::Result<bool> {
let exe = env::current_exe()?;
let parent = match exe.parent().and_then(|p| p.parent()) {
let parent = match exe.parent() {
Some(parent) if parent.file_name().and_then(|n| n.to_str()) == Some("bin") => parent,
_ => return Ok(false),
};
let parent = match parent.parent() {
Some(p) => p,
None => return Ok(false),
};
let expected_file = if cfg!(windows) {
match VSCODE_CLI_QUALITY {
Some("insider") => "Code - Insiders.exe",
Some("exploration") => "Code - Exploration.exe",
_ => "Code.exe",
}
let expected_file = if cfg!(target_os = "darwin") {
"node_modules.asar"
} else {
match VSCODE_CLI_QUALITY {
Some("insider") => "code-insiders",
Some("exploration") => "code-exploration",
_ => "code",
}
"resources.pak"
};
Ok(parent.join(expected_file).exists())