From eb97f7d4f6a6428b52f6cd24e54d3e4650f631a0 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Tue, 14 Sep 2021 13:54:29 +0200 Subject: Fix issue with redirection in run/port (and, by extension, run/string) We would initially create a pipe, dup(2) that onto fd 1 in the forked process and open an output port on the original fd. This resulted in a pretty nasty bug: if the fd would be redirected (by number) later, it would not affect the output port because that was set up to point to the original fd. Instead, open an output port to the newly set up stdout and close the direct pipe port. --- tests/run.scm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests') diff --git a/tests/run.scm b/tests/run.scm index c4ab584..b5fa419 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -107,6 +107,11 @@ "hi, there\n" (run/string (sh -c "echo 'hi, there' >&2") (= 2 1))) + ;; Also reported by Diego "dieggsy" + (test "run/string where (begin) is piped to a program" + "1\n" + (run/string (pipe (begin (print "hey")) (wc -l)))) + (test "Unquote-splicing run/string" "hi, there\n" (run/string (echo ,@(list "hi," "there")))) -- cgit v1.2.3