>From f6f7a948a4496cde6341af2ef140211c1bbe7615 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart Date: Tue, 17 Sep 2024 22:49:03 +0200 Subject: [PATCH] batch-driver.scm: Fix logic to create tempfile Fix the mess introduced by 8ce5a7bfdddb7a537516a. Only create a tempfile when stdout is NOT used. Thanks to siiky for spotting that. --- batch-driver.scm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/batch-driver.scm b/batch-driver.scm index 0cd0a9a0..95a41096 100644 --- a/batch-driver.scm +++ b/batch-driver.scm @@ -232,7 +232,8 @@ ;; Create a temporary file to receive the C code, so that it ;; can atomically be renamed to the actual output file after ;; the C generation. - (tmp-outfile (conc outfile ".tmp." (current-process-id) (current-seconds))) + (tmp-outfile (and outfile + (conc outfile ".tmp." (current-process-id) (current-seconds)))) (opasses (default-optimization-passes)) (time0 #f) (time-breakdown #f) @@ -888,15 +889,16 @@ (with-output-to-file emit-link-file (cut pp exts)))) ;; Code generation - (let ((out (if outfile + (let ((out (if tmp-outfile (open-output-file tmp-outfile) (current-output-port))) ) - (dribble "generating `~A' ..." tmp-outfile) + (when tmp-outfile + (dribble "generating `~A' ..." tmp-outfile)) (generate-code literals lliterals lambda-table out filename user-supplied-options dynamic db dbg-info) (when tmp-outfile - (close-output-port out)) - (rename-file tmp-outfile outfile #t)) + (close-output-port out) + (rename-file tmp-outfile outfile #t))) (end-time "code generation") (when (memq 't debugging-chicken) (##sys#display-times (##sys#stop-timer))) -- 2.39.5