[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'wait -n' with and without id arguments
From: |
Chet Ramey |
Subject: |
Re: 'wait -n' with and without id arguments |
Date: |
Fri, 9 Aug 2024 10:38:44 -0400 |
User-agent: |
Mozilla Thunderbird |
On 7/31/24 3:52 PM, Zachary Santer wrote:
On Wed, Jul 31, 2024 at 11:40 AM Zachary Santer <zsanter@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 chet@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature
- Re: 'wait -n' with and without id arguments, (continued)
- Re: 'wait -n' with and without id arguments, Chet Ramey, 2024/08/14
- Re: 'wait -n' with and without id arguments, Zachary Santer, 2024/08/14
- Re: 'wait -n' with and without id arguments, Zachary Santer, 2024/08/16
- Message not available
- Re: 'wait -n' with and without id arguments, Robert Elz, 2024/08/14
- Re: 'wait -n' with and without id arguments, Chet Ramey, 2024/08/21
- Re: 'wait -n' with and without id arguments, Chet Ramey, 2024/08/21
- Message not available
- Re: 'wait -n' with and without id arguments, Robert Elz, 2024/08/21
Re: 'wait -n' with and without id arguments,
Chet Ramey <=
Re: 'wait -n' with and without id arguments, Zachary Santer, 2024/08/09