Minor refactoring of make_wait_handle

This commit is contained in:
Peter Ammon
2025-07-20 13:40:22 -07:00
parent c9901398ed
commit db0f9c1d53

View File

@@ -521,19 +521,15 @@ pub fn is_completed(&self) -> bool {
/// As a process does not know its job id, we pass it in. /// 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). /// Note this will return null if the process is not waitable (has no pid).
pub fn make_wait_handle(&self, jid: InternalJobId) -> Option<WaitHandleRef> { pub fn make_wait_handle(&self, jid: InternalJobId) -> Option<WaitHandleRef> {
if !matches!(self.typ, ProcessType::External) || self.pid().is_none() { let pid = self.pid()?;
// Not waitable. if self.wait_handle.borrow().is_none() {
None self.wait_handle.replace(Some(WaitHandle::new(
} else { pid,
if self.wait_handle.borrow().is_none() { jid,
self.wait_handle.replace(Some(WaitHandle::new( wbasename(&self.actual_cmd.clone()).to_owned(),
self.pid().unwrap(), )));
jid,
wbasename(&self.actual_cmd.clone()).to_owned(),
)));
}
self.get_wait_handle()
} }
self.get_wait_handle()
} }
} }