Try fix bug on windows

This commit is contained in:
gaofei 2025-01-15 09:06:34 +08:00
parent 5f9314052e
commit 19fc250c3a
6 changed files with 10 additions and 5 deletions

View File

@ -16,3 +16,4 @@ serde_json = "1.0.108"
crossterm = "0.28.1"
once_cell = "1.18.0"
ctrlc = "3.4.1"
windows-sys = "0.36.1"

View File

@ -1,11 +1,18 @@
use super::super::config::dump::DumpConfig;
use super::super::config::log_path;
use ctrlc;
use std::fs::File;
use std::io::{self, BufRead, BufReader, Seek, SeekFrom};
use std::thread;
use std::time::Duration;
pub fn tail_log(target: String) -> io::Result<()> {
ctrlc::set_handler(move || {
println!("\n退出日志查看");
std::process::exit(0);
})
.expect("无法设置Ctrl+C处理器");
let dump_config = DumpConfig::get_instance();
// 解析目标ID

View File

@ -41,7 +41,6 @@ pub fn restart_process(
Ok(())
}
fn restart_existing_process(process: &PmrProcessInfo) -> io::Result<()> {
println!("正在重启进程 '{}'...", process.name);

View File

@ -1,6 +1,6 @@
use super::super::base::process::PmrProcessInfo;
use super::super::config::log_path;
use super::super::config::dump::DumpConfig;
use super::super::config::log_path;
use super::list::list_processes;
use super::stop::stop_process;
use serde::{Deserialize, Serialize};

View File

@ -50,8 +50,6 @@ pub fn stop_process(target: &str, show_list: bool) {
}
.expect("无法执行进程终止命令");
println!("--- test output: {}", output.status);
if output.status.success() {
println!("已停止进程 '{}' (PID: {})", process.name, process.pid);
dump_config

View File

@ -1,7 +1,7 @@
use dirs;
use std::fs;
use std::io;
use std::path::PathBuf;
use dirs;
pub fn get_log_path(pmr_id: u32) -> io::Result<PathBuf> {
let home_dir = dirs::home_dir()