From 8d20bbfcd7c343c8305754f1ecc50b3701cedd9d Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 21 Apr 2024 20:51:44 +0200 Subject: [PATCH] Fix bad assertion warning about disowned jobs that don't get their proper pgroup Running echo foo | vim - gets us in a weird situation because we put the job in fish's process groups. It causes us to not set a PGID for this job, so it can't be resumed among other things. Stopping the job with ctrl-z and try to exit the shell causes a crash in the "There are still jobs active" warning because the PID for the job is still 0. Let's remove the assertion to restore previous behavior, and hopefully fix this later. --- src/proc.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/proc.rs b/src/proc.rs index 0acff52eb..a739d6b20 100644 --- a/src/proc.rs +++ b/src/proc.rs @@ -615,13 +615,11 @@ pub fn new() -> Self { Default::default() } - /// Retrieves the associated [`libc::pid_t`] or panics if no pid has been set (not yet set or - /// process does not get a pid). + /// Retrieves the associated [`libc::pid_t`], 0 if unset. /// /// See [`Process::has_pid()]` to safely check if the process has a pid. pub fn pid(&self) -> libc::pid_t { let value = self.pid.load(Ordering::Relaxed); - assert!(value != 0, "Process::pid() called but pid not set!"); #[allow(clippy::useless_conversion)] value.into() }