diff options
Diffstat (limited to 'module/system/base/compile.scm')
-rw-r--r-- | module/system/base/compile.scm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/module/system/base/compile.scm b/module/system/base/compile.scm index b0c20cfff..9f0ff2f3d 100644 --- a/module/system/base/compile.scm +++ b/module/system/base/compile.scm @@ -73,7 +73,7 @@ thunk (lambda () #t)))) -(define (call-with-output-file/atomic filename proc) +(define* (call-with-output-file/atomic filename proc #:optional reference) (let* ((template (string-append filename ".XXXXXX")) (tmp (mkstemp! template))) (call-once @@ -83,6 +83,9 @@ (proc tmp) (chmod tmp (logand #o0666 (lognot (umask)))) (close-port tmp) + (if reference + (let ((st (stat reference))) + (utime template (stat:atime st) (stat:mtime st)))) (rename-file template filename)) (lambda args (delete-file template))))))) @@ -145,7 +148,8 @@ (lambda (port) ((language-printer (ensure-language to)) (read-and-compile in #:env env #:from from #:to to #:opts opts) - port))) + port)) + file) comp)) (define* (compile-and-load file #:key (from 'scheme) (to 'value) (opts '())) |