What if the process does not write to `stdout` and/or `stderr` (`read_cb` is not or only once called)? Can we still reach `pending_refs == 0`? How would `emit_exit_event` be called?