From c1eaab9192a1808d3acc13bfdaf094a28346d909 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 13 Mar 2017 16:20:52 -0400 Subject: 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. --- Utility/Shell.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Utility') 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 -- cgit v1.2.3