mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-22 12:11:16 -03:00
Minor refactoring of make_wait_handle
This commit is contained in:
20
src/proc.rs
20
src/proc.rs
@@ -521,19 +521,15 @@ pub fn is_completed(&self) -> bool {
|
||||
/// As a process does not know its job id, we pass it in.
|
||||
/// Note this will return null if the process is not waitable (has no pid).
|
||||
pub fn make_wait_handle(&self, jid: InternalJobId) -> Option<WaitHandleRef> {
|
||||
if !matches!(self.typ, ProcessType::External) || self.pid().is_none() {
|
||||
// Not waitable.
|
||||
None
|
||||
} else {
|
||||
if self.wait_handle.borrow().is_none() {
|
||||
self.wait_handle.replace(Some(WaitHandle::new(
|
||||
self.pid().unwrap(),
|
||||
jid,
|
||||
wbasename(&self.actual_cmd.clone()).to_owned(),
|
||||
)));
|
||||
}
|
||||
self.get_wait_handle()
|
||||
let pid = self.pid()?;
|
||||
if self.wait_handle.borrow().is_none() {
|
||||
self.wait_handle.replace(Some(WaitHandle::new(
|
||||
pid,
|
||||
jid,
|
||||
wbasename(&self.actual_cmd.clone()).to_owned(),
|
||||
)));
|
||||
}
|
||||
self.get_wait_handle()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user