mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 23:24:39 +00:00
Bravely do not report completed jobs as stopped
Prior to this change, job_t::is_stopped() returned true if there were zero running processes in the job. This meant that completed jobs were reported as stopped. Stop doing this, it's a footgun.
This commit is contained in:
parent
9b1e04dba2
commit
00a1df3811
1 changed files with 6 additions and 3 deletions
|
@ -96,17 +96,20 @@ void set_job_control_mode(job_control_t mode) {
|
|||
|
||||
void proc_init() { signal_set_handlers_once(false); }
|
||||
|
||||
/// Return true if all processes in the job have stopped or completed.
|
||||
/// Return true if all processes in the job are stopped or completed, and there is at least one
|
||||
/// stopped process.
|
||||
bool job_t::is_stopped() const {
|
||||
bool has_stopped = false;
|
||||
for (const process_ptr_t &p : processes) {
|
||||
if (!p->completed && !p->stopped) {
|
||||
return false;
|
||||
}
|
||||
has_stopped |= p->stopped;
|
||||
}
|
||||
return true;
|
||||
return has_stopped;
|
||||
}
|
||||
|
||||
/// Return true if the last processes in the job has completed.
|
||||
/// Return true if all processes in the job have completed.
|
||||
bool job_t::is_completed() const {
|
||||
assert(!processes.empty());
|
||||
for (const process_ptr_t &p : processes) {
|
||||
|
|
Loading…
Reference in a new issue