| Kenny McCormack 2005-02-08, 3:55 pm |
| In article <42088912.5070607@rest.is.fake>,
Stephan Titard <sgt19_at_tid_dot_es@rest.is.fake> wrote:
>Hi, I seem to get recurrently bitten by this...
>
>10:28:34:
>$ gawk --source='BEGIN { print "ok" > "/hi1"; print "nope" }'
>gawk: fatal: can't redirect to `/hi1' (Permission denied)
>
>any way to catch this in pure gawk
Not without either:
1) Modifying the source code and recompiling. I did this once upon
a time, because I, like you, don't think these things should be fatal.
Actually, I did it in the context of the networking extensions, but, IIRC,
I also did it for the non-network branches.
2) Using something like: system("access ...") to test ahead of time.
Purists will point out that using any form of the access(2) system call
introduces a race condition.
>could we have print return something useful (C-like or not) and catch it
>(would be on par with getline no?)
See above.
|