mirror of
https://github.com/wez/wezterm.git
synced 2024-11-22 13:16:39 +03:00
procinfo: fix linux build
This commit is contained in:
parent
1ad4015f9c
commit
3e05ee667f
@ -334,7 +334,7 @@ impl Pane for LocalPane {
|
||||
fn get_foreground_process_name(&self) -> Option<String> {
|
||||
#[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<Url> {
|
||||
#[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<LocalProcessInfo> {
|
||||
// Windows doesn't have any job control or session concept,
|
||||
// so we infer that the equivalent to the process group
|
||||
|
@ -24,7 +24,7 @@ impl LocalProcessInfo {
|
||||
std::fs::read_link(format!("/proc/{}/cwd", pid)).ok()
|
||||
}
|
||||
|
||||
fn executable_path(pid: u32) -> Option<PathBuf> {
|
||||
pub fn executable_path(pid: u32) -> Option<PathBuf> {
|
||||
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<String> {
|
||||
|
Loading…
Reference in New Issue
Block a user