bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] system() should return != 0 when the process is killed


From: Isabella Parakiss
Subject: Re: [bug-gawk] system() should return != 0 when the process is killed
Date: Sat, 5 Mar 2016 20:40:50 +0100
User-agent: Mutt/1.5.24 (2015-08-30)

On Sat, Mar 05, 2016 at 11:36:08AM -0700, address@hidden wrote:
> Jarno Suni <address@hidden> wrote:
> 
> > In my experience
> >
> >   awk '{system("sleep 1")}'
> >
> > newer exits with any awk I have tried.
> 
> This is because it's waiting for a line of input before
> executing the action.  Try instead
> 
>       awk 'BEGIN { system("sleep 1") }'
> 
> and see what happens.
> 
> Arnold
> 

Gawk will keep on reading:

$ seq 3 | gawk '{ print "<" $0 ">"; system("sleep 1") }'
<1>
^C<2>
<3>

Same for nawk, mawk quits.

$ seq 3 | mawk '{ print "<" $0 ">"; system("sleep 2") }'
<1>
^C


Also worth noting, gawk exits with 0 in this case:
$ seq 3 | awk '{ print "<" $0 ">"; system("sleep 2") }'
<1>
^C<2>
^C<3>
^C

This doesn't look correct...

---
xoxo iza



reply via email to

[Prev in Thread] Current Thread [Next in Thread]