mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-15 09:11:28 +10:00
feat(process): add pre-launch log to file
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
fs::{File, OpenOptions},
|
fs::{File, OpenOptions},
|
||||||
|
io::Write,
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
process::{Child, Command},
|
process::{Child, Command},
|
||||||
sync::LazyLock,
|
sync::LazyLock,
|
||||||
@ -99,7 +100,7 @@ impl ProcessManager {
|
|||||||
info!("launching process {} in {}", command, install_dir);
|
info!("launching process {} in {}", command, install_dir);
|
||||||
|
|
||||||
let current_time = chrono::offset::Local::now();
|
let current_time = chrono::offset::Local::now();
|
||||||
let log_file = OpenOptions::new()
|
let mut log_file = OpenOptions::new()
|
||||||
.write(true)
|
.write(true)
|
||||||
.append(true)
|
.append(true)
|
||||||
.read(true)
|
.read(true)
|
||||||
@ -111,6 +112,13 @@ impl ProcessManager {
|
|||||||
)))
|
)))
|
||||||
.map_err(|v| v.to_string())?;
|
.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)
|
let launch_process = Command::new(command)
|
||||||
.current_dir(install_dir)
|
.current_dir(install_dir)
|
||||||
.stdout(log_file)
|
.stdout(log_file)
|
||||||
|
|||||||
Reference in New Issue
Block a user