mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-27 07:01:00 +03:00
fix(terminal): linux, macOS, win as the controlled (#13930)
1. `TERM` on linux terminal. 2. `htop` command not found on macOS. 3. `vim` and `claude code cli` hung up on windows. Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
@@ -3231,12 +3231,15 @@ impl Connection {
|
||||
if !token.is_null() {
|
||||
match crate::platform::ensure_primary_token(token) {
|
||||
Ok(t) => {
|
||||
self.terminal_user_token = Some(TerminalUserToken::CurrentLogonUser(t as _));
|
||||
self.terminal_user_token = Some(TerminalUserToken::CurrentLogonUser(
|
||||
crate::terminal_service::UserToken::new(t as usize),
|
||||
));
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("Failed to ensure primary token: {}", e);
|
||||
self.terminal_user_token =
|
||||
Some(TerminalUserToken::CurrentLogonUser(token as _));
|
||||
self.terminal_user_token = Some(TerminalUserToken::CurrentLogonUser(
|
||||
crate::terminal_service::UserToken::new(token as usize),
|
||||
));
|
||||
}
|
||||
}
|
||||
None
|
||||
@@ -5049,9 +5052,9 @@ impl Drop for Connection {
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
if let Some(TerminalUserToken::CurrentLogonUser(token)) = self.terminal_user_token.take() {
|
||||
if token != 0 {
|
||||
if token.as_raw() != 0 {
|
||||
unsafe {
|
||||
hbb_common::allow_err!(CloseHandle(HANDLE(token as _)));
|
||||
hbb_common::allow_err!(CloseHandle(HANDLE(token.as_raw() as _)));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user