github.com/rogpeppe/go-internal@v1.12.1-0.20240509064211-c8567cf8e95f/testscript/testdata/wait.txt (about)

     1  [!exec:echo] skip
     2  [!exec:false] skip
     3  
     4  # TODO: the '\n' below doesn't work on Windows on Github Actions, which does
     5  # have coreutils like "echo" installed. Perhaps they emit CRLF?
     6  [windows] skip
     7  
     8  exec echo foo
     9  stdout foo
    10  
    11  exec echo foo &
    12  exec echo bar &
    13  ! exec false &
    14  
    15  # Starting a background process should clear previous output.
    16  ! stdout foo
    17  
    18  # Wait should set the output to the concatenated outputs of the background
    19  # programs, in the order in which they were started.
    20  wait
    21  stdout 'foo\nbar'
    22  
    23  exec echo bg1 &b1&
    24  exec echo bg2 &b2&
    25  exec echo bg3 &b3&
    26  exec echo bg4 &b4&
    27  
    28  wait b3
    29  stdout bg3
    30  wait b2
    31  stdout bg2
    32  wait
    33  stdout 'bg1\nbg4'
    34  
    35  # We should be able to start several background processes and wait for them
    36  # individually.
    37  
    38  # The end of the test should interrupt or kill any remaining background
    39  # programs.
    40  [!exec:sleep] skip
    41  ! exec sleep 86400 &