unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: prj@po.cwru.edu (Paul Jarc)
Cc: guile-devel@gnu.org
Subject: Re: Support for (system '("echo" "foo" "bar"))
Date: Fri, 31 Oct 2003 12:05:49 -0500	[thread overview]
Message-ID: <m3oevxqqv0.fsf@multivac.cwru.edu> (raw)
In-Reply-To: <877k2mgdjs.fsf@raven.i.defaultvalue.org>

Rob Browning <rlb@defaultvalue.org> 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


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2003-10-31 17:05 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-28 21:15 Support for (system '("echo" "foo" "bar")) Rob Browning
2003-10-28 22:13 ` Paul Jarc
2003-10-29  7:58 ` tomas
2003-10-29 13:58 ` Greg Troxel
2003-10-29 14:04   ` Rob Browning
2003-10-29 16:15     ` Marius Vollmer
2003-10-29 18:13       ` Rob Browning
2003-10-29 22:32         ` Paul Jarc
2003-10-30  1:41         ` Alex Shinn
2003-10-30 10:31           ` tomas
2003-10-30 20:09   ` Kevin Ryde
2003-10-31  5:51     ` Rob Browning
2003-10-31 17:05       ` Paul Jarc [this message]
2003-10-31 17:47         ` Rob Browning
2003-10-31 17:59           ` Paul Jarc
2003-10-31 20:15             ` Kevin Ryde
2003-10-31 20:31               ` Paul Jarc
2003-10-31 21:00                 ` Kevin Ryde
2003-10-31 21:18                   ` Paul Jarc
2003-10-31 21:48                     ` Kevin Ryde
2003-10-31 22:10                       ` Paul Jarc
2003-10-31 22:26                         ` Paul Jarc
2003-10-31 22:42                           ` Kevin Ryde
2003-10-31 22:50                         ` Kevin Ryde
2003-10-31 22:59                           ` Paul Jarc
2003-10-31 23:25                             ` Kevin Ryde
2003-10-31 23:34                               ` Paul Jarc
2003-11-02 21:13                                 ` Kevin Ryde
2003-11-10 19:25                                   ` Paul Jarc
2003-12-16 23:45                                     ` Paul Jarc
2003-10-31 22:49               ` Jonathan Bartlett
2003-10-31 20:19       ` Kevin Ryde
2003-10-31 20:37         ` Paul Jarc
2003-10-31 21:02           ` Rob Browning

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3oevxqqv0.fsf@multivac.cwru.edu \
    --to=prj@po.cwru.edu \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).