[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GAWK and the return value ("errorlevel")
From: |
Aharon Robbins |
Subject: |
Re: GAWK and the return value ("errorlevel") |
Date: |
Wed, 2 Feb 2005 16:40:56 +0200 |
>In article <address@hidden>,
>Kenny McCormack <address@hidden> wrote:
>>I've noticed that in current (3.1.4) gawk, if you do something like:
>>
>>gawk 'BEGIN {print "Test" | "somecmd"}' ; echo "Return value: $?"
>>
>>Then if somecmd returns a(ny) non-zero status, then gawk will return 1.
>>To clarify: Yes, I mean that if somecmd returns, say, 7, then gawk will
>>return 1. If "somecmd" returns 0, then gawk will also return 0.
In article <address@hidden>,
Aharon Robbins <address@hidden> wrote:
>This is a bug. I'll look into fixing it.
Here's the fix.
Arnold
--- ../gawk-3.1.4/main.c 2004-07-28 16:42:19.000000000 +0300
+++ main.c 2005-02-02 16:35:21.560782514 +0200
@@ -23,6 +23,9 @@
@@ -572,8 +595,16 @@
(void) interpret(end_block);
}
in_end_rule = FALSE;
+#if 0
if (close_io() != 0 && ! exiting && exit_val == 0)
exit_val = 1;
+#else
+ /*
+ * Other awks don't care about problems closing open files
+ * and pipes, in that it doesn't affect their exit status.
+ */
+ (void) close_io();
+#endif
if (do_profiling) {
dump_prog(begin_block, expression_value, end_block);
--
Aharon (Arnold) Robbins --- Pioneer Consulting Ltd. arnold AT skeeve DOT com
P.O. Box 354 Home Phone: +972 8 979-0381 Fax: +1 206 350 8765
Nof Ayalon Cell Phone: +972 50 729-7545
D.N. Shimshon 99785 ISRAEL
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: GAWK and the return value ("errorlevel"),
Aharon Robbins <=