summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-10-17 12:39:43 +0800
committerGitHub <noreply@github.com>2024-10-17 12:39:43 +0800
commitaf1e57f7c6e3259be48783175289b158cd763a10 (patch)
treeaa1bb6eb801803daf1e42c1c14fc03720cc12b63 /src
parent81db81518adb2509bc018f1942ddc3308df521f3 (diff)
downloadaichat-af1e57f7c6e3259be48783175289b158cd763a10.tar.gz
fix: unexpected error while piping to shell execution on macOS (#930)
Diffstat (limited to 'src')
-rw-r--r--src/main.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 3725258..ec61370 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -141,6 +141,9 @@ async fn run(config: GlobalConfig, cli: Cli, text: Option<String>) -> Result<()>
}
let is_repl = config.read().working_mode.is_repl();
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).await?;
shell_execute(&config, &SHELL, input).await?;
return Ok(());