Print the recompilation command into the error file

When `stack build --silent` fails, the output is not helpful at all:

    Errors detected while compiling xmonad config: /home/slot/.config/xmonad/xmonad.hs
    ExitFailure 1

    Please check the file for errors.

And even in other circumstances it's helpful to see the command that was
executed, as it makes it easy for the user to diagnose what's wrong.
This commit is contained in:
Tomas Janousek 2021-08-17 10:42:09 +01:00
parent ae97c1f107
commit 7bdc7ab9dc

View File

@ -677,6 +677,8 @@ compile dirs method =
-- waitForProcess =<< System.Process.runProcess, but without closing the err handle
runProc cwd err exe args = do
hPutStrLn err $ unwords $ "$" : exe : args
hFlush err
(_, _, _, h) <- createProcess_ "runProc" (proc exe args){ cwd = Just cwd, std_err = UseHandle err }
waitForProcess h