guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 02/02: squash! Make 'system*' and 'piped-process' intern


From: Ludovic Courtès
Subject: [Guile-commits] 02/02: squash! Make 'system*' and 'piped-process' internally use 'spawn'.
Date: Fri, 13 Jan 2023 09:57:49 -0500 (EST)

civodul pushed a commit to branch wip-posix-spawn
in repository guile.

commit 7f3f86897b0c420a19873909de1c78e685292d9f
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Jan 13 15:47:04 2023 +0100

    squash! Make 'system*' and 'piped-process' internally use 'spawn'.
    
    Fixes <https://bugs.gnu.org/52835>.
    
    * test-suite/tests/posix.test ("system*")["https://bugs.gnu.org/52835"]:
    New test.
    * NEWS: Update.
---
 NEWS                        |  6 ++++++
 test-suite/tests/posix.test | 18 +++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index b3d31cf89..f1c53efe7 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,10 @@ robust, and more efficient than the combination of 
`primitive-fork' and
 paper entitled "A fork() in the road" (Andrew Baumann et al.) for
 background information.
 
+`system*', as well as the `open-pipe' and `pipeline' procedures of
+(ice-9 popen) are now implemented in terms of `posix_spawn' as well,
+which fixes bugs such as redirects: <https://bugs.gnu.org/52835>.
+
 ** `open-file' now supports an "e" flag for O_CLOEXEC
 
 Until now, the high-level `open-file' facility did not provide a way to
@@ -93,6 +97,8 @@ Disassembler output now includes the name of intrinsics next 
to each
 ** Fix documentation of ‘mkdir’
    Previously, the documentation implied the umask was ignored if the
    mode was set explicitly.  However, this is not the case.
+** 'system*' honors output/error port redirects
+   (https://bugs.gnu.org/52835)
 
 
 Changes in 3.0.8 (since 3.0.7)
diff --git a/test-suite/tests/posix.test b/test-suite/tests/posix.test
index ad13a0a07..bd3e6218c 100644
--- a/test-suite/tests/posix.test
+++ b/test-suite/tests/posix.test
@@ -358,7 +358,23 @@
     ;; fd 2 in the child process, which in turn would cause it to
     ;; segfault, leading to a wrong exit code.
     (parameterize ((current-output-port (current-error-port)))
-      (status:exit-val (system* "something-that-does-not-exist")))))
+      (status:exit-val (system* "something-that-does-not-exist"))))
+
+  (pass-if-equal "https://bugs.gnu.org/52835";
+      "bong\n"
+    (let ((file (tmpnam)))
+      ;; Redirect stdout and stderr to FILE.
+      (define status
+        (call-with-output-file file
+          (lambda (port)
+            (with-output-to-port port
+              (lambda ()
+                (with-error-to-port port
+                  (lambda ()
+                    (system* "sh" "-c" "echo bong >&2"))))))))
+
+      (and (zero? (status:exit-val status))
+           (call-with-input-file file get-string-all)))))
 
 ;;
 ;; spawn



reply via email to

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