diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-03-13 16:20:52 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-03-13 16:20:52 -0400 |
commit | c1eaab9192a1808d3acc13bfdaf094a28346d909 (patch) | |
tree | c850b984148772fc1a34905f66ffe7976ef1edba /Utility | |
parent | b55c32d4c6cb63ffd6d9ce49eee8be95628c9746 (diff) |
Windows: Fix bug in shell script shebang lookup code that caused a "delayed read on closed handle" error.
The bug was that withFile closes the handle afterwards, but the content
of the file was not read due to laziness. Using readFile avoids it.
This commit was sponsored by Nick Daly on Patreon.
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/Shell.hs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Utility/Shell.hs b/Utility/Shell.hs index 116ab6164..b8a9491dc 100644 --- a/Utility/Shell.hs +++ b/Utility/Shell.hs @@ -49,8 +49,7 @@ findShellCommand f = do #ifndef mingw32_HOST_OS defcmd #else - l <- catchDefaultIO Nothing $ withFile f ReadMode $ - headMaybe . lines <$$> hGetContents + l <- catchDefaultIO Nothing $ headMaybe . lines <$> readFile f case l of Just ('#':'!':rest) -> case words rest of [] -> defcmd |