1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:17:35 +00:00

ps: Don't assert when coming across a zombie process

Fixes #1278.
This commit is contained in:
Andreas Kling 2020-02-27 10:37:07 +01:00
parent 72cbbd5297
commit 9632388bed

View file

@ -65,15 +65,18 @@ int main(int argc, char** argv)
else
tty = "n/a";
auto* state = proc.threads.is_empty() ? "Zombie" : proc.threads.first().state.characters();
auto times_scheduled = proc.threads.is_empty() ? 0 : proc.threads.first().times_scheduled;
printf("%-3u %-3u %-3u %-3u %-3u %-11s %-3u %-9u %-3u %-5s %s\n",
proc.pid,
proc.pgid,
proc.pgp,
proc.sid,
proc.uid,
proc.threads.first().state.characters(),
state,
proc.ppid,
proc.threads.first().times_scheduled,
times_scheduled,
proc.nfds,
tty.characters(),
proc.name.characters());