merge: sync upstream/main into fork main (v0.15.2)
This commit is contained in:
@@ -159,7 +159,13 @@ fn is_daemon_running(session: &str) -> bool {
|
||||
if let Ok(pid_str) = fs::read_to_string(&pid_path) {
|
||||
if let Ok(pid) = pid_str.trim().parse::<i32>() {
|
||||
unsafe {
|
||||
return libc::kill(pid, 0) == 0;
|
||||
if libc::kill(pid, 0) == 0 {
|
||||
return true;
|
||||
}
|
||||
// EPERM means the process exists but we lack permission to
|
||||
// signal it (e.g. inside a macOS sandbox). Only ESRCH means
|
||||
// the process is genuinely gone.
|
||||
return std::io::Error::last_os_error().raw_os_error() != Some(libc::ESRCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -72,7 +72,11 @@ fn run_session(args: &[String], session: &str, json_mode: bool) {
|
||||
if let Ok(pid_str) = fs::read_to_string(&pid_path) {
|
||||
if let Ok(pid) = pid_str.trim().parse::<u32>() {
|
||||
#[cfg(unix)]
|
||||
let running = unsafe { libc::kill(pid as i32, 0) == 0 };
|
||||
let running = unsafe {
|
||||
libc::kill(pid as i32, 0) == 0
|
||||
|| std::io::Error::last_os_error().raw_os_error()
|
||||
!= Some(libc::ESRCH)
|
||||
};
|
||||
#[cfg(windows)]
|
||||
let running = unsafe {
|
||||
let handle =
|
||||
|
||||
+12
-4
@@ -344,10 +344,14 @@ pub fn print_response_with_opts(resp: &Response, action: Option<&str>, opts: &Ou
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Cleared requests
|
||||
// Cleared (cookies or request log)
|
||||
if let Some(cleared) = data.get("cleared").and_then(|v| v.as_bool()) {
|
||||
if cleared {
|
||||
println!("{} Request log cleared", color::success_indicator());
|
||||
let label = match action {
|
||||
Some("cookies_clear") => "Cookies cleared",
|
||||
_ => "Request log cleared",
|
||||
};
|
||||
println!("{} {}", color::success_indicator(), label);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -408,9 +412,13 @@ pub fn print_response_with_opts(resp: &Response, action: Option<&str>, opts: &Ou
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Closed
|
||||
// Closed (browser or tab)
|
||||
if data.get("closed").is_some() {
|
||||
println!("{} Browser closed", color::success_indicator());
|
||||
let label = match action {
|
||||
Some("tab_close") => "Tab closed",
|
||||
_ => "Browser closed",
|
||||
};
|
||||
println!("{} {}", color::success_indicator(), label);
|
||||
return;
|
||||
}
|
||||
// Recording start (has "started" field)
|
||||
|
||||
Reference in New Issue
Block a user