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
|
@ -15,6 +15,8 @@ git-annex (6.20170301.2) UNRELEASED; urgency=medium
|
||||||
program, searching for the program in the PATH.
|
program, searching for the program in the PATH.
|
||||||
* Drop support for building with old versions of dns, http-conduit,
|
* Drop support for building with old versions of dns, http-conduit,
|
||||||
directory, feed, and http-types.
|
directory, feed, and http-types.
|
||||||
|
* Windows: Fix bug in shell script shebang lookup code that
|
||||||
|
caused a "delayed read on closed handle" error.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Thu, 02 Mar 2017 12:51:40 -0400
|
-- Joey Hess <id@joeyh.name> Thu, 02 Mar 2017 12:51:40 -0400
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,7 @@ findShellCommand f = do
|
||||||
#ifndef mingw32_HOST_OS
|
#ifndef mingw32_HOST_OS
|
||||||
defcmd
|
defcmd
|
||||||
#else
|
#else
|
||||||
l <- catchDefaultIO Nothing $ withFile f ReadMode $
|
l <- catchDefaultIO Nothing $ headMaybe . lines <$> readFile f
|
||||||
headMaybe . lines <$$> hGetContents
|
|
||||||
case l of
|
case l of
|
||||||
Just ('#':'!':rest) -> case words rest of
|
Just ('#':'!':rest) -> case words rest of
|
||||||
[] -> defcmd
|
[] -> defcmd
|
||||||
|
|
|
@ -40,3 +40,5 @@ Same as before, windows, git-bash
|
||||||
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
|
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
|
||||||
|
|
||||||
Thanks for the quick response earlier. I hope this is helpful information. Keep up the great work! :)
|
Thanks for the quick response earlier. I hope this is helpful information. Keep up the great work! :)
|
||||||
|
|
||||||
|
> Reproduced this bug, and I've committed a fix. [[done]] --[[Joey]]
|
||||||
|
|
Loading…
Reference in a new issue