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.
This commit is contained in:
Johannes Altmanninger 2024-04-21 20:51:44 +02:00
parent fd61bad946
commit 8d20bbfcd7

View file

@ -615,13 +615,11 @@ impl Process {
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()
}