diff --git a/mux/src/localpane.rs b/mux/src/localpane.rs index 660ca1df6..207d01219 100644 --- a/mux/src/localpane.rs +++ b/mux/src/localpane.rs @@ -334,7 +334,7 @@ impl Pane for LocalPane { fn get_foreground_process_name(&self) -> Option { #[cfg(unix)] if let Some(pid) = self.pty.borrow().process_group_leader() { - if let Ok(path) = LocalProcessInfo::executable_path(pid) { + if let Some(path) = LocalProcessInfo::executable_path(pid as u32) { return Some(path.to_string_lossy().to_string()); } } @@ -729,7 +729,7 @@ impl LocalPane { fn divine_current_working_dir(&self) -> Option { #[cfg(unix)] if let Some(pid) = self.pty.borrow().process_group_leader() { - if let Some(path) = LocalProcessInfo::current_working_dir(pid) { + if let Some(path) = LocalProcessInfo::current_working_dir(pid as u32) { return Url::parse(&format!("file://localhost{}", path.display())).ok(); } } @@ -750,6 +750,7 @@ impl LocalPane { None } + #[allow(dead_code)] fn divine_foreground_process(&self) -> Option { // Windows doesn't have any job control or session concept, // so we infer that the equivalent to the process group diff --git a/procinfo/src/linux.rs b/procinfo/src/linux.rs index f3b1d5103..9211f6155 100644 --- a/procinfo/src/linux.rs +++ b/procinfo/src/linux.rs @@ -24,7 +24,7 @@ impl LocalProcessInfo { std::fs::read_link(format!("/proc/{}/cwd", pid)).ok() } - fn executable_path(pid: u32) -> Option { + pub fn executable_path(pid: u32) -> Option { std::fs::read_link(format!("/proc/{}/exe", pid)).ok() } @@ -80,8 +80,9 @@ impl LocalProcessInfo { fn exe_for_pid(pid: pid_t) -> PathBuf { std::fs::read_link(format!("/proc/{}/exe", pid)).unwrap_or_else(|_| PathBuf::new()) } + fn cwd_for_pid(pid: pid_t) -> PathBuf { - current_working_dir(pid).unwrap_or_else(|| PathBuf::new()) + LocalProcessInfo::current_working_dir(pid as u32).unwrap_or_else(|| PathBuf::new()) } fn parse_cmdline(pid: pid_t) -> Vec {