From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Rob Browning Newsgroups: gmane.lisp.guile.devel Subject: Re: Support for (system '("echo" "foo" "bar")) Date: Thu, 30 Oct 2003 23:51:35 -0600 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <877k2mgdjs.fsf@raven.i.defaultvalue.org> References: <87ad7l9i8h.fsf@raven.i.defaultvalue.org> <87u15qpjwk.fsf@zip.com.au> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1067579648 3994 80.91.224.253 (31 Oct 2003 05:54:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 31 Oct 2003 05:54:08 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Oct 31 06:54:06 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AFSEY-0008Rt-00 for ; Fri, 31 Oct 2003 06:54:06 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AFSEH-0008F4-Qg for guile-devel@m.gmane.org; Fri, 31 Oct 2003 00:53:49 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AFSEA-0008Dg-HN for guile-devel@gnu.org; Fri, 31 Oct 2003 00:53:42 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AFSDd-0007pK-2j for guile-devel@gnu.org; Fri, 31 Oct 2003 00:53:41 -0500 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.24) id 1AFSDc-0007by-Ji for guile-devel@gnu.org; Fri, 31 Oct 2003 00:53:08 -0500 Original-Received: from [66.93.216.237] (helo=defaultvalue.org) by mx20.gnu.org with esmtp (Exim 4.24) id 1AFSC9-0000IF-Tu for guile-devel@gnu.org; Fri, 31 Oct 2003 00:51:38 -0500 Original-Received: from raven.i.defaultvalue.org (raven.i.defaultvalue.org [192.168.1.7]) by defaultvalue.org (Postfix) with ESMTP id 0FC3E3F4A for ; Thu, 30 Oct 2003 23:51:36 -0600 (CST) Original-Received: by raven.i.defaultvalue.org (Postfix, from userid 1000) id D5ED68106C; Thu, 30 Oct 2003 23:51:35 -0600 (CST) Original-To: guile-devel@gnu.org In-Reply-To: <87u15qpjwk.fsf@zip.com.au> (Kevin Ryde's message of "Fri, 31 Oct 2003 06:09:31 +1000") User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:2937 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2937 Kevin Ryde writes: > If it does a fork and exec then it could be called fork-exec :). > > The old DOS systems used to use "spawn" for that sort of thing I think > (spawnl, spawnle, etc like the exec functions). > > Either way, if it can get the errno back to the parent when exec fails > (and use _exit) then it'd be a nice improvement over a fork and exec > one might write explicitly. (A close-on-exec pipe is a good way to do > that.) Right now I just have this first (quick) pass at (system* . args), which should provide access to errno via scm_execlp: { if (SCM_NULLP (cmds)) SCM_WRONG_TYPE_ARG (1, cmds); if (SCM_CONSP (cmds)) { // better be a list of strings, and we call exec. int pid = fork (); if (pid == -1) SCM_SYSERROR; else if (pid) { int wait_result; int status; SCM_SYSCALL (wait_result = waitpid (pid, &status, 0)); if (wait_result == -1) SCM_SYSERROR; return SCM_MAKINUM (0L + status); } else { scm_execlp (SCM_CAR(cmds), cmds); SCM_SYSERROR; /* not reached. */ return SCM_BOOL_F; } } else SCM_WRONG_TYPE_ARG (1, SCM_CAR (cmds)); } -- Rob Browning rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu GPG starting 2002-11-03 = 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4 _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel