Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions brush-builtins/src/wait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,9 @@ impl builtins::Command for WaitCommand {
}
}
} else {
// Wait for all jobs.
let jobs = context.shell.jobs_mut().wait_all().await?;

if context.shell.options().enable_job_control {
for job in jobs {
writeln!(context.stdout(), "{job}")?;
}
}
// Wait for all jobs but produce no output. Job notices are emitted
// separately by the interactive prompt cycle.
let _ = context.shell.jobs_mut().wait_all().await?;
}

Ok(result)
Expand Down
25 changes: 25 additions & 0 deletions brush-shell/tests/cases/compat/builtins/wait.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,31 @@ cases:
wait
echo "after wait all"

- name: "wait is silent for top-level background job with job control"
args:
- "-c"
- |
set -m
echo hello &
wait
echo after

- name: "wait is silent for background jobs in a subshell piped to a filter"
args:
- "-c"
- |
set -m
( for i in 1 2 3; do echo "item-$i" & done; wait ) | sort

- name: "wait is silent for backgrounded brace group with job control"
args:
- "-c"
- |
set -m
{ echo grouped; } &
wait
echo done

- name: "wait -n not implemented"
known_failure: true # TODO(builtins): wait -n not implemented
stdin: |
Expand Down
Loading