diff options
| author | sigoden <sigoden@gmail.com> | 2025-06-03 07:50:47 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-03 07:50:47 +0800 |
| commit | 4fecd67007595469f6deb4b78d9f12388939810c (patch) | |
| tree | 8b9361fc62781987a41b944fb445633be0284b1a | |
| parent | d7dd1ec96cc815be4c9f23f8495247b02a683ac2 (diff) | |
| download | aichat-4fecd67007595469f6deb4b78d9f12388939810c.tar.gz | |
fix: better error handling for `aichat -e` on MacOS (#1311)
| -rw-r--r-- | src/main.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index e02c9db..c68b935 100644 --- a/src/main.rs +++ b/src/main.rs @@ -174,9 +174,6 @@ async fn run(config: GlobalConfig, cli: Cli, text: Option<String>) -> Result<()> return Ok(()); } if cli.execute && !is_repl { - if cfg!(target_os = "macos") && !stdin().is_terminal() { - bail!("Unable to read the pipe for shell execution on MacOS") - } let input = create_input(&config, text, &cli.file, abort_signal.clone()).await?; shell_execute(&config, &SHELL, input, abort_signal.clone()).await?; return Ok(()); @@ -265,6 +262,9 @@ async fn shell_execute( return Ok(()); } if *IS_STDOUT_TERMINAL { + if cfg!(target_os = "macos") && !stdin().is_terminal() { + bail!("Unable to read the pipe for shell execution on MacOS") + } let options = ["execute", "revise", "describe", "copy", "quit"]; let command = color_text(eval_str.trim(), nu_ansi_term::Color::Rgb(255, 165, 0)); let first_letter_color = nu_ansi_term::Color::Cyan; |
