On 7/31/24 3:52 PM, Zachary Santer wrote:
On Wed, Jul 31, 2024 at 11:40 AM Zachary Santer <zsan...@gmail.com> wrote:Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: msys Compiler: gcc Compilation CFLAGS: -g -O2 uname output: MSYS_NT-10.0-19045 Zack2021HPPavilion 3.5.3-d8b21b8c.x86_64 2024-07-09 18:03 UTC x86_64 Msys Machine Type: x86_64-pc-msys Bash Version: 5.3 Patch Level: 0 Release Status: alpha See attached.When I was executing the script normally, not sourcing it, in that email, that was bash 5.2.26(1)-release. To avoid confusion, please reference the attachments to this email instead.
OK, I see what's happening. When the shell is interactive, it notifies the user when a background job terminates and prints a message to the terminal. That's the series of [2] Done random_sleep messages you see. Once that happens, the shell considers the job `notified' and removes it from the jobs table. That's when it moves to the list of saved background pids and statuses. It's available there for `wait' when you supply a pid argument, but no longer eligible to be returned by `wait -n' without arguments, since it's already terminated and the user has been notified of the status. When I source your script on macOS with the current devel build, I get the set of notification messages and termination with a false argument, and an infinite loop with a true argument. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature