guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-18-g03a2f5


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-18-g03a2f59
Date: Tue, 08 Jan 2013 14:34:01 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=03a2f59851ff9e9ae751c92c5608ef2a197c4938

The branch, stable-2.0 has been updated
       via  03a2f59851ff9e9ae751c92c5608ef2a197c4938 (commit)
      from  ed3e8b8e06adaaa1df5085a0f730d42efa3f5c30 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 03a2f59851ff9e9ae751c92c5608ef2a197c4938
Author: Andy Wingo <address@hidden>
Date:   Tue Jan 8 12:58:05 2013 +0100

    slight open-pipe* / open-process refactor
    
    * libguile/posix.c (scm_open_process): Return the ports as values
      instead of calling out to Scheme again to make-rw-port.  This
      function is private to (ice-9 popen).
    
    * module/ice-9/popen.scm (open-pipe*): Adapt to change.

-----------------------------------------------------------------------

Summary of changes:
 libguile/posix.c       |   25 ++++---------------------
 module/ice-9/popen.scm |   18 ++++++++++++------
 2 files changed, 16 insertions(+), 27 deletions(-)

diff --git a/libguile/posix.c b/libguile/posix.c
index ce64256..4d5fdcf 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- *   2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software 
Foundation, Inc.
+ *   2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software 
Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -1351,7 +1351,7 @@ scm_open_process (SCM mode, SCM prog, SCM args)
   if (pid)
     /* Parent. */
     {
-      SCM read_port = SCM_BOOL_F, write_port = SCM_BOOL_F, port;
+      SCM read_port = SCM_BOOL_F, write_port = SCM_BOOL_F;
 
       /* There is no sense in catching errors on close().  */
       if (reading) 
@@ -1367,25 +1367,8 @@ scm_open_process (SCM mode, SCM prog, SCM args)
           scm_setvbuf (write_port, scm_from_int (_IONBF), SCM_UNDEFINED);
         }
       
-      if (reading && writing)
-        {
-          static SCM make_rw_port = SCM_BOOL_F;
-
-          if (scm_is_false (make_rw_port))
-            make_rw_port = scm_c_private_variable ("ice-9 popen",
-                                                   "make-rw-port");
-
-          port = scm_call_2 (scm_variable_ref (make_rw_port),
-                             read_port, write_port);
-        }
-      else if (reading)
-        port = read_port;
-      else if (writing)
-        port = write_port;
-      else
-        port = scm_sys_make_void_port (mode);
-
-      return scm_cons (port, scm_from_int (pid));
+      return scm_values
+        (scm_list_3 (read_port, write_port, scm_from_int (pid)));
     }
   
   /* The child.  */
diff --git a/module/ice-9/popen.scm b/module/ice-9/popen.scm
index 7ca4868..7d0549e 100644
--- a/module/ice-9/popen.scm
+++ b/module/ice-9/popen.scm
@@ -1,6 +1,6 @@
 ;; popen emulation, for non-stdio based ports.
 
-;;;; Copyright (C) 1998, 1999, 2000, 2001, 2003, 2006, 2010, 2011, 2012 Free 
Software Foundation, Inc.
+;;;; Copyright (C) 1998, 1999, 2000, 2001, 2003, 2006, 2010, 2011, 2012, 2013 
Free Software Foundation, Inc.
 ;;;; 
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
@@ -49,11 +49,17 @@ A port to the process (based on pipes) is created and 
returned.
 @var{mode} specifies whether an input, an output or an input-output
 port to the process is created: it should be the value of
 @code{OPEN_READ}, @code{OPEN_WRITE} or @code{OPEN_BOTH}."
-  (let* ((port/pid (apply open-process mode command args))
-        (port (car port/pid)))
-    (pipe-guardian port)
-    (hashq-set! port/pid-table port (cdr port/pid))
-    port))
+  (call-with-values (lambda ()
+                      (apply open-process mode command args))
+    (lambda (read-port write-port pid)
+      (let ((port (or (and read-port write-port
+                           (make-rw-port read-port write-port))
+                      read-port
+                      write-port
+                      (%make-void-port mode))))
+        (pipe-guardian port)
+        (hashq-set! port/pid-table port pid)
+        port))))
 
 (define (open-pipe command mode)
   "Executes the shell command @var{command} (a string) in a subprocess.


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]