Skip to content

Commit a71a62f

Browse files
authored
[solana-install-init] Optimize error message for Windows user permission installation (pyth-network#234)
* feat: check user's permissions in Windows * feat: Remove check fun and check os_err * fmt and optimize code
1 parent 1fc4e38 commit a71a62f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

install/src/command.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,13 +1171,17 @@ pub fn init_or_update(config_file: &str, is_init: bool, check_only: bool) -> Res
11711171
release_dir.join("solana-release"),
11721172
config.active_release_dir(),
11731173
)
1174-
.map_err(|err| {
1175-
format!(
1174+
.map_err(|err| match err.raw_os_error() {
1175+
#[cfg(windows)]
1176+
Some(os_err) if os_err == winapi::shared::winerror::ERROR_PRIVILEGE_NOT_HELD => {
1177+
"You need to run this command with administrator privileges.".to_string()
1178+
}
1179+
_ => format!(
11761180
"Unable to symlink {:?} to {:?}: {}",
11771181
release_dir,
11781182
config.active_release_dir(),
11791183
err
1180-
)
1184+
),
11811185
})?;
11821186

11831187
config.save(config_file)?;

0 commit comments

Comments
 (0)