Skip to content

Commit beb3db1

Browse files
committed
Enhance log stdout and stderr output for script execution
Added logging for both standard output and error output in the run_scripts function to improve visibility of script execution results. This includes logging info for successful outputs and warnings for errors.
1 parent 0a3d53f commit beb3db1

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/lib/greenboot.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,14 @@ fn run_scripts(name: &str, path: &str, disabled_scripts: Option<&[String]>) -> S
158158
match output {
159159
Ok(o) if o.status.success() => {
160160
log::info!("{} script {} success!", name, entry.to_string_lossy());
161+
let stdout = String::from_utf8_lossy(&o.stdout);
162+
let stderr = String::from_utf8_lossy(&o.stderr);
163+
if !stdout.trim().is_empty() {
164+
log::info!("{}", stdout.trim_end());
165+
}
166+
if !stderr.trim().is_empty() {
167+
log::warn!("{}", stderr.trim_end());
168+
}
161169
}
162170
Ok(o) => {
163171
let error_msg = format!(

0 commit comments

Comments
 (0)