diff --git a/src/event.cpp b/src/event.cpp index 3fb88b43c..40b281fe5 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -128,6 +128,7 @@ wcstring event_get_desc(const event_t &e) { if (e.param1.pid > 0) { result = format_string(_(L"exit handler for process %d"), e.param1.pid); } else { + // In events, PGIDs are stored as negative PIDs job_t *j = job_get_from_pid(-e.param1.pid); if (j) result = format_string(_(L"exit handler for job %d, '%ls'"), j->job_id, @@ -209,6 +210,7 @@ static wcstring event_desc_compact(const event_t &event) { } else if (event.param1.pid > 0) { res = format_string(L"EVENT_EXIT(pid %d)", event.param1.pid); } else { + // In events, PGIDs are stored as negative PIDs job_t *j = job_get_from_pid(-event.param1.pid); if (j) res = format_string(L"EVENT_EXIT(jobid %d: \"%ls\")", j->job_id, diff --git a/src/event.h b/src/event.h index aa05030d9..f549ce0ec 100644 --- a/src/event.h +++ b/src/event.h @@ -53,7 +53,7 @@ struct event_t { /// The type-specific parameter. The int types are one of the following: /// /// signal: Signal number for signal-type events.Use EVENT_ANY_SIGNAL to match any signal - /// pid: Process id for process-type events. Use EVENT_ANY_PID to match any pid. + /// pid: Process id for process-type events. Use EVENT_ANY_PID to match any pid. (Negative values are used for PGIDs). /// job_id: Job id for EVENT_JOB_ID type events union { int signal;