Re: [PATCH 4/8] doc: simplify the handling of interruptions

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

 



Junio C Hamano wrote:
> Felipe Contreras <felipe.contreras@xxxxxxxxx> writes:
> 
> > +"${args[@]}" -o "$out" "$1" ||
> > +{ rm -f "$out"; false; }
> 
> It would be so nice if this worked, but here is what I saw in a
> quick-and-dirty experiment:
> 
>     $ f hoi || rm hoi ;# wait a bit and hit ^C
> 
> So, I suspect it unfortunately may not work well.

That's because the interrupt signal is not caught.

This works:

  sh -c 'echo foo >"$1" && trap "exit 1" INT && sleep 20' test hoi || rm hoi

And so does this:

  #!/bin/sh

  ruby - hoi <<EOF || rm hoi
  File.write(ARGV[0], 'foo')
  begin
    sleep(10)
  rescue Exception
    exit(1)
  end
  EOF

Both asciidoc and asciidoctor trap the signal.

> We need to get 2/8 redone without bash-ism,

Yes, if we agree this approach is indeed desirable I can do that.

Cheers.

-- 
Felipe Contreras



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux