Skip to content

Commit 0d5e5c5

Browse files
fix(cli): write exec stderr events to stderr in interactive mode (#2447)
The Stderr arm of the interactive exec event loop locked stdout, so stderr payloads were written to stdout. The non-interactive exec path already handles the same event with stderr. Write stderr payloads to stderr so shell redirection (e.g. 'openshell exec ... 2>err.txt') works in interactive mode. Signed-off-by: Andrew White <[email protected]>
1 parent 2022d53 commit 0d5e5c5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • crates/openshell-cli/src

‎crates/openshell-cli/src/run.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3315,6 +3315,7 @@ async fn sandbox_exec_interactive_grpc(
33153315

33163316
let mut exit_code = 0i32;
33173317
let stdout = std::io::stdout();
3318+
let stderr = std::io::stderr();
33183319

33193320
while let Some(event) = stream.next().await {
33203321
let event = event.into_diagnostic()?;
@@ -3325,7 +3326,7 @@ async fn sandbox_exec_interactive_grpc(
33253326
handle.flush().into_diagnostic()?;
33263327
}
33273328
Some(exec_sandbox_event::Payload::Stderr(err)) => {
3328-
let mut handle = stdout.lock();
3329+
let mut handle = stderr.lock();
33293330
handle.write_all(&err.data).into_diagnostic()?;
33303331
handle.flush().into_diagnostic()?;
33313332
}

0 commit comments

Comments
 (0)