From b71845512c0f4707c99873dd3373163a0e505ab1 Mon Sep 17 00:00:00 2001 From: shhyou Date: Sat, 19 Dec 2020 11:03:42 -0600 Subject: [PATCH] Redirecting stderr to a temporary file Avoid using (current-error-port) since it may not be a file stream port. --- pkgs/racket-test-core/tests/racket/subprocess.rktl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkgs/racket-test-core/tests/racket/subprocess.rktl b/pkgs/racket-test-core/tests/racket/subprocess.rktl index 04a8f7bd9b..fbfc3118ac 100644 --- a/pkgs/racket-test-core/tests/racket/subprocess.rktl +++ b/pkgs/racket-test-core/tests/racket/subprocess.rktl @@ -634,9 +634,9 @@ (when (eq? 'windows (system-type)) (define (try-arg cmdline-str result-str) - (let () + (let ([f (open-output-file tmpfile #:exists 'truncate/replace)]) (define-values (sp i o no-e) - (subprocess #f #f (current-error-port) self 'exact + (subprocess #f #f f self 'exact (string-append (regexp-replace* #rx" " (path->string self) "\" \"") " -l racket/base" " -e \"(write (vector-ref (current-command-line-arguments) 0))\"" @@ -644,17 +644,19 @@ (close-output-port o) (test result-str read i) (subprocess-wait sp) + (close-output-port f) (close-input-port i)) ;; Check encoding by `subprocess`, too - (let () + (let ([f (open-output-file tmpfile #:exists 'truncate/replace)]) (define-values (sp i o no-e) - (subprocess #f #f (current-error-port) self + (subprocess #f #f f self "-l" "racket/base" "-e" "(write (vector-ref (current-command-line-arguments) 0))" result-str)) (close-output-port o) (test result-str read i) (subprocess-wait sp) + (close-output-port f) (close-input-port i))) (try-arg "x" "x")