Hi Everyone,
I am strugling to get the following code to work correctly and I'm hoping
someone will be able to shed some light as to why the code is behaving
as it does:
{-| runs the supplied command and args as a SHELL command -}
runShell :: String -> IO (String, ExitCode)
runShell shellCmd = do
(_, Just hOut, Just hErr, hProcess) <- createProcess (shell shellCmd) { std_out = CreatePipe, std_err = CreatePipe }
exitCode <- waitForProcess hProcess
outTxt <- hGetContents hOut
errTxt <- hGetContents hErr
return $ (outTxt
++ errTxt, exitCode)
If I try to su the runShell function with the following command, it simply
blocks forever:
git --no-pager blame <your git file here>
but if I do:
git status
The runShell function works as expected. Can someone shed some light on why the 'git blame' command blocks? Interrestingly enough, if I remove the waitForProcess action, the 'git blame' command starts working as expected, but I no longer have my blocking behaviour, waiting for the command to finish and return the ExitCode.
Regards
Rouan