diff --git a/tests/gpgscm/init.scm b/tests/gpgscm/init.scm index 66bec0f79..4c8c5125c 100644 --- a/tests/gpgscm/init.scm +++ b/tests/gpgscm/init.scm @@ -654,8 +654,11 @@ ;; resource management a chance to clean up. (define *interpreter-exit* (gensym)) +(define *exit-status* 0) + ;; Terminate the process returning STATUS to the parent. (define (exit status) + (set! *exit-status* status) (throw "interpreter exit" *interpreter-exit* status)) ;; A list of functions run at interpreter shutdown. diff --git a/tests/gpgscm/tests.scm b/tests/gpgscm/tests.scm index 51410020e..dbeda74d7 100644 --- a/tests/gpgscm/tests.scm +++ b/tests/gpgscm/tests.scm @@ -288,7 +288,7 @@ ;; Otherwise this works like mkdtemp. (define (mkdtemp-autoremove . components) (let ((dir (apply mkdtemp components))) - (atexit (lambda () (unlink-recursively dir))) + (atexit (lambda () (if (= *exit-status* 0) (unlink-recursively dir)))) dir)) (define-macro (with-temporary-working-directory . expressions)