From af1e57f7c6e3259be48783175289b158cd763a10 Mon Sep 17 00:00:00 2001 From: sigoden Date: Thu, 17 Oct 2024 12:39:43 +0800 Subject: fix: unexpected error while piping to shell execution on macOS (#930) --- src/main.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/main.rs') 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) -> 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(()); -- cgit v1.2.3