Re: wait and ctrl+Z

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Marc Glisse <marc.glisse@xxxxxxxx> wrote:
> Hello,
> 
> I noticed a strange behavior of "wait" when I suspend and resume a script.
> 
> $ cat a.sh
> #!/bin/dash
> (sleep 7; echo blah) &
> (sleep 7; echo bloh) &
> wait ; echo coucou
> $ ./a.sh
> ^Z
> zsh: suspended  ./a.sh
> $ fg
> [1]  + continued  ./a.sh
> coucou
> $ blah
> bloh
> 
> As you can see, the instruction after "wait" was executed immediatly on 
> resume, without waiting for the jobs.
> 
> If I replace the ';' after "wait" by "&&" and do the same suspend+resume, 
> "coucou" is never printed.
> 
> I am using dash version 0.5.7-3 in debian testing.

That's normal as wait was interrupted by a signal.  If you want
to wait even after an interruption, you should check the return
value of wait.

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux