Commit cde62c8e authored by Ben Gamari's avatar Ben Gamari 🐢
Browse files

Utils: Emit current working directory of run processes in debug output

This mitigates the inconvenience of #4757.
parent 538cdbd8
......@@ -695,17 +695,21 @@ maybeExit cmd = do
printRawCommandAndArgs :: Verbosity -> FilePath -> [String] -> IO ()
printRawCommandAndArgs verbosity path args = withFrozenCallStack $
printRawCommandAndArgsAndEnv verbosity path args Nothing
printRawCommandAndArgsAndEnv verbosity path args Nothing Nothing
printRawCommandAndArgsAndEnv :: Verbosity
-> FilePath
-> [String]
-> Maybe FilePath
-> Maybe [(String, String)]
-> IO ()
printRawCommandAndArgsAndEnv verbosity path args menv = do
printRawCommandAndArgsAndEnv verbosity path args mcwd menv = do
case menv of
Just env -> debugNoWrap verbosity ("Environment: " ++ show env)
Nothing -> return ()
case mcwd of
Just cwd -> debugNoWrap verbosity ("Working directory: " ++ show cwd)
Nothing -> return ()
infoNoWrap verbosity (showCommandForUser path args)
-- Exit with the same exit code if the subcommand fails
......@@ -733,7 +737,7 @@ rawSystemExitWithEnv :: Verbosity
-> [(String, String)]
-> IO ()
rawSystemExitWithEnv verbosity path args env = withFrozenCallStack $ do
printRawCommandAndArgsAndEnv verbosity path args (Just env)
printRawCommandAndArgsAndEnv verbosity path args Nothing (Just env)
hFlush stdout
(_,_,_,ph) <- createProcess $
(Process.proc path args) { Process.env = (Just env)
......@@ -784,7 +788,7 @@ createProcessWithEnv ::
-- ^ Any handles created for stdin, stdout, or stderr
-- with 'CreateProcess', and a handle to the process.
createProcessWithEnv verbosity path args mcwd menv inp out err = withFrozenCallStack $ do
printRawCommandAndArgsAndEnv verbosity path args menv
printRawCommandAndArgsAndEnv verbosity path args mcwd menv
hFlush stdout
(inp', out', err', ph) <- createProcess $
(Process.proc path args) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment