diff --git a/crates/vm-manager/src/ssh.rs b/crates/vm-manager/src/ssh.rs index 3f13818..1d51603 100644 --- a/crates/vm-manager/src/ssh.rs +++ b/crates/vm-manager/src/ssh.rs @@ -104,16 +104,13 @@ pub fn exec_streaming( detail: format!("channel session: {e}"), })?; - // Non-blocking mode so we can interleave stdout and stderr reads - sess.set_blocking(false); - - channel.exec(cmd).map_err(|e| { - sess.set_blocking(true); - VmError::SshFailed { - detail: format!("exec '{cmd}': {e}"), - } + channel.exec(cmd).map_err(|e| VmError::SshFailed { + detail: format!("exec '{cmd}': {e}"), })?; + // Switch to non-blocking after exec so we can interleave stdout and stderr reads + sess.set_blocking(false); + let mut stdout_buf = Vec::new(); let mut stderr_buf = Vec::new(); let mut buf = [0u8; 8192];