I haven't checked carefully, but I think you need to work around this
with something like
``` lisp
(let (result)
(uiop:with-current-directory (dir)
(setq result
(uiop:run-program (list "some" "program") :output :string)))
result)
```
The problem with changing this behavior is that it wouldn't be
forwards-compatible: if you write code that depends on this change, you
would have to condition it on the ASDF release version. So I don't
*object* to making the change, but it's a niche issue and one that could
cause headaches when ASDF/UIOP aren't updated. So I'm not going to code
it up myself, but I would consider a merge request.
Best,
R
On 19 Aug 2024, at 17:01, Kevin Zheng wrote:
Hi asdf developers,
I recently was writing some code with UIOP:CALL-WITH-CURRENT-DIRECTORY
and came across something slightly unexpected.
In particular, running CALL-WITH-CURRENT-DIRECTORY or
WITH-CURRENT-DIRECTORY forms evaluates to NIL, whereas one may expect
that the form evaluates to the return value of THUNK or the macro
body, respectively.
In my program, I'm trying to do something like:
(uiop:with-current-directory (dir)
(uiop:run-program (list "some" "program") :output :string))
Which doesn't quite do what I want it to do.
I believe this has to do with the definition, which ends in a trailing
(chdir dir) form to get out of the directory which unfortunately
returns NIL instead of the value from evaluating THUNK.
So my question is: would it be acceptable if a future version of UIOP
changes call-with-current-directory to return the value of evaluating
THUNK?
Thanks,
Kevin