Special-case PID 0 on FreeBSD

PID 0 is the kernel; when the shell exits, the process ID for
the session becomes 0. Downstream bug report
	https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258996
wilder
Adriaan de Groot 4 years ago committed by Kurt Hindenburg
parent 3b3dd14d67
commit c2a0e4cfb2
  1. 12
      src/session/Session.cpp

@ -1620,10 +1620,20 @@ int Session::foregroundProcessId()
bool Session::isForegroundProcessActive()
{
const auto pid = processId();
const auto fgid = _shellProcess->foregroundProcessGroup();
// On FreeBSD, after exiting the shell, the foreground GID is
// an invalid value, and the "shell" PID is 0. Those are not equal,
// so the check below would return true.
if (pid == 0) {
return false;
}
// This check is wrong when Konsole is started with '-e cmd'
// as there will only be one process.
// See BKO 134581 for no popup when closing session
return (processId() != _shellProcess->foregroundProcessGroup());
return (pid != fgid);
}
QString Session::foregroundProcessName()

Loading…
Cancel
Save