fix(client): truncate long commands and output in log lines (max 60 chars)

This commit is contained in:
Helios Agent 2026-03-03 15:06:30 +01:00
parent ccf585f801
commit ef4ca0ccbb
No known key found for this signature in database
GPG key ID: C8259547CD8309B5

View file

@ -320,15 +320,26 @@ async fn handle_message(
}
ServerMessage::ExecRequest { request_id, command } => {
log_cmd!("exec {}", command);
// Truncate long commands for display
let cmd_display = if command.len() > 60 {
format!("{}", &command[..60])
} else {
command.clone()
};
log_cmd!("exec {}", cmd_display);
let mut sh = shell.lock().await;
match sh.run(&command).await {
Ok((stdout, stderr, exit_code)) => {
let out = stdout.trim().lines().next().unwrap_or("").to_string();
if out.is_empty() {
log_ok!("Done {} exit {}", "·".dimmed(), exit_code);
let out_display = if out.len() > 60 {
format!("{}", &out[..60])
} else {
log_ok!("{} {} exit {}", out, "·".dimmed(), exit_code);
out
};
if out_display.is_empty() {
log_ok!("exit {}", exit_code);
} else {
log_ok!("{} {} exit {}", out_display, "·".dimmed(), exit_code);
}
let _ = stderr;
ClientMessage::ExecResponse {