diff --git a/crates/client/src/shell.rs b/crates/client/src/shell.rs index 39addca..9593938 100644 --- a/crates/client/src/shell.rs +++ b/crates/client/src/shell.rs @@ -119,9 +119,13 @@ impl PersistentShell { } Ok(Ok(_)) => { debug!("stdout line: {line:?}"); - if line.trim_end().starts_with(SENTINEL) { - // Parse exit code from sentinel line - let code_str = line.trim_end().trim_start_matches(SENTINEL); + if line.contains(SENTINEL) { + // Parse exit code from sentinel line (use contains for Windows + // compatibility: cmd.exe echoes the prompt before the sentinel, + // e.g. "C:\Users\...>__HELIOS_DONE__0\r\n") + let sentinel_pos = line.find(SENTINEL).unwrap_or(0); + let code_str = &line[sentinel_pos..]; + let code_str = code_str.trim_end().trim_start_matches(SENTINEL); exit_code = code_str.trim().parse().unwrap_or(0); break; } else {