mirror of
https://github.com/haskell-nix/hnix-store.git
synced 2025-01-06 03:06:58 +03:00
Fix NAR parsing failure when not enough input is available
Replaces `hGetSome` with `hGet`, which should continue reading until the requested number of bytes have been read in. This avoids a potential failure mode where the requested bytes are not immediately available/buffered. Resolves #225.
This commit is contained in:
parent
f0dfc6d670
commit
47e9174d08
@ -421,7 +421,7 @@ consume
|
||||
consume 0 = pure ""
|
||||
consume n = do
|
||||
state0 <- State.get
|
||||
newBytes <- IO.liftIO $ Bytes.hGetSome (handle state0) (max 0 n)
|
||||
newBytes <- IO.liftIO $ Bytes.hGet (handle state0) (max 0 n)
|
||||
when (Bytes.length newBytes < n) $
|
||||
Fail.fail $
|
||||
"consume: Not enough bytes in handle. Wanted "
|
||||
|
Loading…
Reference in New Issue
Block a user