[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Support for (system '("echo" "foo" "bar"))
From: |
Paul Jarc |
Subject: |
Re: Support for (system '("echo" "foo" "bar")) |
Date: |
Fri, 31 Oct 2003 12:05:49 -0500 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) |
Rob Browning <address@hidden> wrote:
> {
> if (SCM_NULLP (cmds))
> SCM_WRONG_TYPE_ARG (1, cmds);
>
> if (SCM_CONSP (cmds))
...
> else
> SCM_WRONG_TYPE_ARG (1, SCM_CAR (cmds));
This doesn't look right - you're looking at (car cmds) when cmds is
not a cons. How about:
{
if (! SCM_CONSP (cmds))
SCM_WRONG_TYPE_ARG (1, cmds);
...
}
That should catch the null case too. Or, to get the behavior Kevin
described:
(define (system* . args)
(flush-all-ports)
(let* ((p (pipe))
(pid (primitive-fork)))
(if (zero? pid)
(catch
'system-error
(lambda ()
(close-port (car p))
(fcntl (cdr p) F_SETFD FD_CLOEXEC)
(apply execlp (car args) args))
(lambda . exception
(write exception (cdr p))
(force-output (cdr p))
(primitive-exit)))
(begin
(close-port (cdr p))
(let* ((exception (read (car p)))
(status (cdr (waitpid pid))))
(close-port (car p))
(if (not (eof-object? exception))
(apply throw exception)
status))))))
paul
- Re: Support for (system '("echo" "foo" "bar")), (continued)
- Re: Support for (system '("echo" "foo" "bar")), tomas, 2003/10/29
- Re: Support for (system '("echo" "foo" "bar")), Greg Troxel, 2003/10/29
- Re: Support for (system '("echo" "foo" "bar")), Rob Browning, 2003/10/29
- Re: Support for (system '("echo" "foo" "bar")), Marius Vollmer, 2003/10/29
- Re: Support for (system '("echo" "foo" "bar")), Rob Browning, 2003/10/29
- Re: Support for (system '("echo" "foo" "bar")), Paul Jarc, 2003/10/29
- Re: Support for (system '("echo" "foo" "bar")), Alex Shinn, 2003/10/29
- Re: Support for (system '("echo" "foo" "bar")), tomas, 2003/10/30
Re: Support for (system '("echo" "foo" "bar")), Kevin Ryde, 2003/10/30
- Re: Support for (system '("echo" "foo" "bar")), Rob Browning, 2003/10/31
- Re: Support for (system '("echo" "foo" "bar")),
Paul Jarc <=
- Re: Support for (system '("echo" "foo" "bar")), Rob Browning, 2003/10/31
- Re: Support for (system '("echo" "foo" "bar")), Paul Jarc, 2003/10/31
- Re: Support for (system '("echo" "foo" "bar")), Kevin Ryde, 2003/10/31
- Re: Support for (system '("echo" "foo" "bar")), Paul Jarc, 2003/10/31
- Re: Support for (system '("echo" "foo" "bar")), Kevin Ryde, 2003/10/31
- Re: Support for (system '("echo" "foo" "bar")), Paul Jarc, 2003/10/31
- Re: Support for (system '("echo" "foo" "bar")), Kevin Ryde, 2003/10/31
- Re: Support for (system '("echo" "foo" "bar")), Paul Jarc, 2003/10/31
- Re: Support for (system '("echo" "foo" "bar")), Paul Jarc, 2003/10/31
- Re: Support for (system '("echo" "foo" "bar")), Kevin Ryde, 2003/10/31