fix: RDP panic logging + CWD starts at home directory
All checks were successful
Build & Sign Wraith / Build Windows + Sign (push) Successful in 3m16s
All checks were successful
Build & Sign Wraith / Build Windows + Sign (push) Successful in 3m16s
RDP: wrapped connection thread in catch_unwind so panics are logged to wraith.log instead of silently killing the channel. Error message now directs user to check the log. CWD: changed cd . to cd ~ after OSC 7 hook injection so SFTP starts at the user's home directory on macOS (where / requires explicit nav). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
83b746df0e
commit
03bb6f3ccf
@ -119,6 +119,7 @@ impl RdpService {
|
|||||||
let (ready_tx, ready_rx) = std::sync::mpsc::channel::<Result<(), String>>();
|
let (ready_tx, ready_rx) = std::sync::mpsc::channel::<Result<(), String>>();
|
||||||
|
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
|
let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
|
||||||
let rt = tokio::runtime::Builder::new_current_thread()
|
let rt = tokio::runtime::Builder::new_current_thread()
|
||||||
.enable_all()
|
.enable_all()
|
||||||
.build()
|
.build()
|
||||||
@ -166,6 +167,18 @@ impl RdpService {
|
|||||||
info!("RDP session {} ended", sid);
|
info!("RDP session {} ended", sid);
|
||||||
sessions_ref.remove(&sid);
|
sessions_ref.remove(&sid);
|
||||||
});
|
});
|
||||||
|
}));
|
||||||
|
if let Err(panic) = result {
|
||||||
|
let msg = if let Some(s) = panic.downcast_ref::<String>() {
|
||||||
|
s.clone()
|
||||||
|
} else if let Some(s) = panic.downcast_ref::<&str>() {
|
||||||
|
s.to_string()
|
||||||
|
} else {
|
||||||
|
"unknown panic".to_string()
|
||||||
|
};
|
||||||
|
let _ = crate::write_log(&crate::data_directory().join("wraith.log"), &format!("RDP thread PANIC: {}", msg));
|
||||||
|
// ready_tx is dropped here, which triggers the "died unexpectedly" error
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
match ready_rx.recv() {
|
match ready_rx.recv() {
|
||||||
@ -176,7 +189,7 @@ impl RdpService {
|
|||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
self.sessions.remove(&session_id);
|
self.sessions.remove(&session_id);
|
||||||
return Err("RDP connection thread died unexpectedly".into());
|
return Err("RDP connection thread panicked — check wraith.log for details".into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -168,7 +168,7 @@ impl SshService {
|
|||||||
"__wraith_osc7() { printf '\\e]7;file://localhost/%s\\a' \"$(pwd | sed 's/ /%20/g')\"; }; ",
|
"__wraith_osc7() { printf '\\e]7;file://localhost/%s\\a' \"$(pwd | sed 's/ /%20/g')\"; }; ",
|
||||||
"if [ -n \"$ZSH_VERSION\" ]; then precmd() { __wraith_osc7; }; ",
|
"if [ -n \"$ZSH_VERSION\" ]; then precmd() { __wraith_osc7; }; ",
|
||||||
"elif [ -n \"$BASH_VERSION\" ]; then PROMPT_COMMAND=__wraith_osc7; fi; ",
|
"elif [ -n \"$BASH_VERSION\" ]; then PROMPT_COMMAND=__wraith_osc7; fi; ",
|
||||||
"stty echo; clear; cd .\n"
|
"stty echo; clear; cd ~\n"
|
||||||
);
|
);
|
||||||
let h = handle.lock().await;
|
let h = handle.lock().await;
|
||||||
let _ = h.data(channel_id, CryptoVec::from_slice(osc7_hook.as_bytes())).await;
|
let _ = h.data(channel_id, CryptoVec::from_slice(osc7_hook.as_bytes())).await;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user