fix(zone-exec): catch panic errors and show all errors immediately (#359)

This commit is contained in:
alex authored and GitHub committed 2024-08-25 07:16:20 +00:00
1 parent 96ccbd50bb
commit 0106b85de9
3 files changed
+40 -34

No files matched your search

+7 -2
View File
@@ -1,4 +1,4 @@
use anyhow::{anyhow, Result};
use anyhow::Result;
use async_stream::stream;
use crossterm::{
terminal::{disable_raw_mode, enable_raw_mode, is_raw_mode_enabled},
@@ -118,7 +118,12 @@ impl StdioConsoleStream {
return if reply.error.is_empty() {
Ok(reply.exit_code)
} else {
Err(anyhow!("exec failed: {}", reply.error))
StdioConsoleStream::restore_terminal_mode();
stderr
.write_all(format!("Error: exec failed: {}\n", reply.error).as_bytes())
.await?;
stderr.flush().await?;
Ok(-1)
};
}
}