summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2025-06-03 07:50:47 +0800
committerGitHub <noreply@github.com>2025-06-03 07:50:47 +0800
commit4fecd67007595469f6deb4b78d9f12388939810c (patch)
tree8b9361fc62781987a41b944fb445633be0284b1a /src
parentd7dd1ec96cc815be4c9f23f8495247b02a683ac2 (diff)
downloadaichat-4fecd67007595469f6deb4b78d9f12388939810c.tar.gz
fix: better error handling for `aichat -e` on MacOS (#1311)
Diffstat (limited to 'src')
-rw-r--r--src/main.rs6
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;