From e803aa488c3a95193d3e3ae358b640c299f8f121 Mon Sep 17 00:00:00 2001 From: salmonik Date: Mon, 23 Nov 2026 20:36:22 +0100 Subject: License --- src/tools/shell.rs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/tools/shell.rs') diff --git a/src/tools/shell.rs b/src/tools/shell.rs index c64bab3..7f909bc 100644 --- a/src/tools/shell.rs +++ b/src/tools/shell.rs @@ -1,3 +1,10 @@ +/* + * This file is part of agent686 + * Copyright (C) 2026 Salmonik + * SPDX-License-Identifier: GPL-3.0-or-later + * https://git.2137697.xyz/agent686 + */ + use std::fs::File; use std::io::{Read, Seek, SeekFrom}; use std::os::unix::process::{CommandExt, ExitStatusExt}; @@ -32,11 +39,7 @@ impl Drop for TempGuard { } } -pub fn bash( - args: &Value, - timeout: Duration, - cancel: &AtomicBool, -) -> Result { +pub fn bash(args: &Value, timeout: Duration, cancel: &AtomicBool) -> Result { let cmd = match args .get("cmd") .or_else(|| args.get("command")) @@ -146,14 +149,14 @@ pub fn bash( } else if aborted { "[aborted by the user]".to_string() } else if timed_out { - format!("[timed out after {:.1}s; process killed]", timeout.as_secs_f64()) + format!( + "[timed out after {:.1}s; process killed]", + timeout.as_secs_f64() + ) } else { match status.code() { Some(code) => format!("[exit {code}]"), - None => format!( - "[killed by signal {}]", - status.signal().unwrap_or_default() - ), + None => format!("[killed by signal {}]", status.signal().unwrap_or_default()), } }; -- cgit v1.2.3