[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: System commands with error escaping
From: |
白熊 |
Subject: |
Re: System commands with error escaping |
Date: |
Thu, 27 Nov 2014 14:12:39 +0300 |
User-agent: |
K-9 Mail for Android |
On 2014年11月27日 9:45:26 GMT+03:00, Thien-Thi Nguyen <address@hidden> wrote:
>
>Personally, i use ‘(ttn-do zzz subprocess) call-process’, from
>package ttn-do (http://www.gnuvola.org/software/ttn-do/).
Hi:
Thanks for the recommendation. I've inspected ttn-do, however it seems too old
to me, for instance relies on the obsolete (ice-9 optargs-kw). Didn't check
further, anyhow couldn't build it...
I've settled on the simple approach now:
(let ((return (system command-string)))
(if (not (eqv? 0 return))
(throw 'error)))
Which stop fine if run like this. However the problem is, if I define a routine
like this:
(define (test-command command-string)
(let ((return (system command-string)))
(if (not (eqv? 0 return))
(throw 'error))))
then call it from somewhere, it doesn't halt code execution, throws the error,
then continues with other commands, that follow the test-command call...
Tried with (exit) instead of (throw 'error), but same thing, can't initiate a
break of all subroutines and immediate code execution halt, with no further
commands.
I'm sure I'm missing something simple... Can anyone point me in the right
direction?
--
白熊@相撲道