Description
In order to make stack development / debugging easier, it would be nice if you could rely on copying+pasting process invocations out of the verbose log. This will require a couple things:
-
Make sure temporary files needed by these processes stick around after stack is done executing. In order to ensure eventual deletion, we can either put things in the system temp directory, or manage our own temp directory.
For example, currently with
stack solver -v
, you will get a cabal invocation which involves an argument like--config-file=/tmp/cabal-solver3217/cabal.config
. It useswithSystemTempDirectory
, which deletes the files involved.In some circumstances, it the temporary files may be quite large, and so it's wasteful to keep them around. For this, we can have a utility like
withTempDir DeletePromptly $ \dir -> ...
, and changing the argument toDeleteLazily
will cause the stuff to linger. This way, there's a very straightforward change that can be made to enable debugging. -
When the process logging stuff that has a CWD, output it as a
(cd CWD && cmd)
. This way, it'll temporarily set the current work dir of a subshell. -
In some cases, we can use commandline arguments instead of setting CWD - Git should use --git-dir and --work-tree not changing directory #1577