On Apr 3 00:22, Andrey Repin wrote:
> Greetings, All!
>
> The script (let's call it test.sh):
>
> #!/bin/dash -x
> _lock="./console-session.lock"
> {
> flock -n 9 || {
> echo "The $(cat "$_lock") command is running already."
> exit 3
> } >&2
>
> printf "$1" >&9
>
> trap 'rm "$_lock";' EXIT HUP INT ABRT TERM
>
> sleep 20
>
> } 9>> "$_lock"
>
> Very simple in essence.
> The one-liner:
>
> { flock -n 9 && sleep 10 || echo Fail;} 9>> ./console-session.lock
>
> Also extremely simple.
>
> Open two terminals. mintty or native, bash or dash, doesn't matter.
> chdir to the directory with the script.
>
> Start script in one terminal. ./test.sh
> Start oneliner in another terminal. Fail. How predictable!I don't know what I'm doing wrong, but this WJFFM with Cygwin 2.4.1 as well as 2.5.0. Additionally I tried to put the oneliner into a script but it still WFM. Apart from that, did you notice the flock restrictions outlined in https://cygwin.com/cygwin-api/std-notes.html ? Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat
signature.asc
Description: PGP signature

