signal an error when we can't change-directory in with-directory (issue #850)

This commit is contained in:
Alex Shinn 2022-08-11 21:56:35 +09:00
parent 7e0b2730f4
commit f367cb86e2

View file

@ -104,7 +104,9 @@
(define (with-directory dir thunk)
(let ((pwd (current-directory)))
(dynamic-wind
(lambda () (change-directory dir))
(lambda ()
(if (not (change-directory dir))
(error "couldn't change directory" dir)))
thunk
(lambda () (change-directory pwd)))))