* exit upon first error?
@ 2007-05-08 21:10 David Fang
2007-05-09 8:26 ` Ludovic Courtès
0 siblings, 1 reply; 3+ messages in thread
From: David Fang @ 2007-05-08 21:10 UTC (permalink / raw)
To: guile-user
Hi,
Is there a way to force guile to exit upon first error (uncaught
dynwind), analogous to "sh -e"? Though this isn't something one would
want interactively, it might be useful for non-interactive scripts to bail
out as soon as something goes wrong, rather than continue generating
errors. Thanks in advance.
Fang
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: exit upon first error?
2007-05-08 21:10 exit upon first error? David Fang
@ 2007-05-09 8:26 ` Ludovic Courtès
2007-05-09 11:07 ` Ludovic Courtès
0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2007-05-09 8:26 UTC (permalink / raw)
To: David Fang; +Cc: guile-user
Hi,
David Fang <fang@csl.cornell.edu> writes:
> Is there a way to force guile to exit upon first error (uncaught
> dynwind), analogous to "sh -e"? Though this isn't something one would
> want interactively, it might be useful for non-interactive scripts to bail
> out as soon as something goes wrong, rather than continue generating
> errors. Thanks in advance.
AFAIK, the only way to achieve this is by calling `exit':
$ guile -c '(exit (begin #f))' ; echo $?
1
It converts `#f' to a non-zero exit value and anything else to zero.
Hope this helps,
Ludovic.
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: exit upon first error?
2007-05-09 8:26 ` Ludovic Courtès
@ 2007-05-09 11:07 ` Ludovic Courtès
0 siblings, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2007-05-09 11:07 UTC (permalink / raw)
To: David Fang; +Cc: guile-user
ludovic.courtes@laas.fr (Ludovic Courtès) writes:
> David Fang <fang@csl.cornell.edu> writes:
>
>> Is there a way to force guile to exit upon first error (uncaught
>> dynwind), analogous to "sh -e"? Though this isn't something one would
>> want interactively, it might be useful for non-interactive scripts to bail
>> out as soon as something goes wrong, rather than continue generating
>> errors. Thanks in advance.
>
> AFAIK, the only way to achieve this is by calling `exit':
And yes, you have to enclose your code in `dynamic-wind' or `catch'.
Thanks,
Ludovic.
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-05-09 11:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-08 21:10 exit upon first error? David Fang
2007-05-09 8:26 ` Ludovic Courtès
2007-05-09 11:07 ` Ludovic Courtès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).