mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-07 10:01:14 -03:00
Add debug categories for reaping processes
This commit is contained in:
@@ -61,6 +61,11 @@ class category_list_t {
|
||||
|
||||
category_t proc_internal_proc{L"proc-internal-proc", L"Internal (non-forked) process events"};
|
||||
|
||||
category_t proc_reap_internal{L"proc-reap-internal",
|
||||
L"Reaping internal (non-forked) processes"};
|
||||
|
||||
category_t proc_reap_external{L"proc-reap-external", L"Reaping external (forked) processes"};
|
||||
|
||||
category_t env_locale{L"env-locale", L"Changes to locale variables"};
|
||||
|
||||
category_t env_export{L"env-export", L"Changes to exported variables"};
|
||||
|
||||
@@ -377,6 +377,10 @@ static void process_mark_finished_children(parser_t &parser, bool block_ok) {
|
||||
if (proc->internal_proc_->exited()) {
|
||||
proc->status = proc->internal_proc_->get_status();
|
||||
proc->completed = true;
|
||||
FLOGF(proc_reap_internal,
|
||||
"Reaped internal process '%ls' (id %llu, status %d)",
|
||||
proc->argv0(), proc->internal_proc_->get_id(),
|
||||
proc->status.status_value());
|
||||
}
|
||||
} else if (proc->pid > 0) {
|
||||
// Try reaping an external process.
|
||||
@@ -384,8 +388,10 @@ static void process_mark_finished_children(parser_t &parser, bool block_ok) {
|
||||
auto pid = waitpid(proc->pid, &status, WNOHANG | WUNTRACED);
|
||||
if (pid > 0) {
|
||||
assert(pid == proc->pid && "Unexpcted waitpid() return");
|
||||
debug(4, "Reaped PID %d", pid);
|
||||
handle_child_status(proc.get(), proc_status_t::from_waitpid(status));
|
||||
FLOGF(proc_reap_external,
|
||||
"Reaped external process '%ls' (pid %d, status %d)",
|
||||
proc->argv0(), pid, proc->status.status_value());
|
||||
}
|
||||
} else {
|
||||
assert(0 && "Don't know how to reap this process");
|
||||
|
||||
Reference in New Issue
Block a user