feat(process): add pre-launch log to file

This commit is contained in:
DecDuck
2024-12-24 11:59:59 +11:00
parent 6cc0c679b9
commit 17f8d763ca

View File

@ -1,6 +1,7 @@
use std::{
collections::HashMap,
fs::{File, OpenOptions},
io::Write,
path::PathBuf,
process::{Child, Command},
sync::LazyLock,
@ -99,7 +100,7 @@ impl ProcessManager {
info!("launching process {} in {}", command, install_dir);
let current_time = chrono::offset::Local::now();
let log_file = OpenOptions::new()
let mut log_file = OpenOptions::new()
.write(true)
.append(true)
.read(true)
@ -111,6 +112,13 @@ impl ProcessManager {
)))
.map_err(|v| v.to_string())?;
writeln!(
log_file,
"Drop: launching {} with args {:?} in {}",
command, args, install_dir
)
.map_err(|e| e.to_string())?;
let launch_process = Command::new(command)
.current_dir(install_dir)
.stdout(log_file)