diff options
| author | Ellie Huxtable <ellie@atuin.sh> | 2025-07-22 16:03:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-22 16:03:20 +0200 |
| commit | e7819d258a29eeec0e9255a961fee3b44735afab (patch) | |
| tree | e76946f1906d29e999485f3b2bd424fc7375037f /crates/atuin-scripts/src | |
| parent | Update indicatif to 0.18.0 (#2833) (diff) | |
| download | atuin-e7819d258a29eeec0e9255a961fee3b44735afab.zip | |
chore: update to rust 1.88 (#2815)
* chore: update to rust 1.88
* clippy + fmt
* update ci version
* update flake
Diffstat (limited to 'crates/atuin-scripts/src')
| -rw-r--r-- | crates/atuin-scripts/src/execution.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/crates/atuin-scripts/src/execution.rs b/crates/atuin-scripts/src/execution.rs index 90f7c4eb..8605d142 100644 --- a/crates/atuin-scripts/src/execution.rs +++ b/crates/atuin-scripts/src/execution.rs @@ -13,11 +13,11 @@ use tracing::debug; pub fn build_executable_script(script: String, shebang: String) -> String { if shebang.is_empty() { // Default to bash if no shebang is provided - format!("#!/usr/bin/env bash\n{}", script) + format!("#!/usr/bin/env bash\n{script}") } else if script.starts_with("#!") { - format!("{}\n{}", shebang, script) + format!("{shebang}\n{script}") } else { - format!("#!{}\n{}", shebang, script) + format!("#!{shebang}\n{script}") } } @@ -149,7 +149,7 @@ pub async fn execute_script_interactive( let mut child = match child_result { Ok(child) => child, Err(e) => { - return Err(format!("Failed to execute script: {}", e).into()); + return Err(format!("Failed to execute script: {e}").into()); } }; @@ -176,11 +176,11 @@ pub async fn execute_script_interactive( tokio::spawn(async move { while let Some(input) = stdin_rx.recv().await { if let Err(e) = stdin.write_all(input.as_bytes()).await { - eprintln!("Error writing to stdin: {}", e); + eprintln!("Error writing to stdin: {e}"); break; } if let Err(e) = stdin.flush().await { - eprintln!("Error flushing stdin: {}", e); + eprintln!("Error flushing stdin: {e}"); break; } } @@ -199,16 +199,16 @@ pub async fn execute_script_interactive( Ok(0) => break, // End of stdout Ok(n) => { if let Err(e) = stdout_writer.write_all(&buffer[0..n]).await { - eprintln!("Error writing to stdout: {}", e); + eprintln!("Error writing to stdout: {e}"); break; } if let Err(e) = stdout_writer.flush().await { - eprintln!("Error flushing stdout: {}", e); + eprintln!("Error flushing stdout: {e}"); break; } } Err(e) => { - eprintln!("Error reading from process stdout: {}", e); + eprintln!("Error reading from process stdout: {e}"); break; } } @@ -227,16 +227,16 @@ pub async fn execute_script_interactive( Ok(0) => break, // End of stderr Ok(n) => { if let Err(e) = stderr_writer.write_all(&buffer[0..n]).await { - eprintln!("Error writing to stderr: {}", e); + eprintln!("Error writing to stderr: {e}"); break; } if let Err(e) = stderr_writer.flush().await { - eprintln!("Error flushing stderr: {}", e); + eprintln!("Error flushing stderr: {e}"); break; } } Err(e) => { - eprintln!("Error reading from process stderr: {}", e); + eprintln!("Error reading from process stderr: {e}"); break; } } @@ -257,7 +257,7 @@ pub async fn execute_script_interactive( status } Err(e) => { - eprintln!("Error waiting for child process: {}", e); + eprintln!("Error waiting for child process: {e}"); // Send a default error code let _ = exit_code_tx.send(-1).await; return; @@ -266,11 +266,11 @@ pub async fn execute_script_interactive( // Wait for stdout/stderr tasks to complete if let Err(e) = stdout_handle.await { - eprintln!("Error joining stdout task: {}", e); + eprintln!("Error joining stdout task: {e}"); } if let Err(e) = stderr_handle.await { - eprintln!("Error joining stderr task: {}", e); + eprintln!("Error joining stderr task: {e}"); } // Send the exit code |
