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.
This commit is contained in:
parent
1c4e5f65fc
commit
d1ecdd04b2
3 changed files with 5 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue