From f303aae37a826503eb63703d1045c0fd38d21e55 Mon Sep 17 00:00:00 2001 From: sigoden Date: Thu, 17 Oct 2024 12:27:35 +0800 Subject: [PATCH] fix: unexpected error while piping to shell execution on macOS --- src/main.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.rs b/src/main.rs index 37252587..ec613700 100644 --- a/src/main.rs +++ b/src/main.rs @@ -141,6 +141,9 @@ async fn run(config: GlobalConfig, cli: Cli, text: Option) -> 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(());