close stdin handles before waiting on commands

Fixes reversion in recent conversions, the old code relied on the GC
apparently, but the new code explicitly waits on the process, so must
close stdin handle first or the command will never exit.
This commit is contained in:
Joey Hess 2020-06-05 17:27:49 -04:00
parent ef0024444b
commit e41f8c83f3
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 7 additions and 7 deletions

View file

@ -166,10 +166,10 @@ store' r k b p = go =<< glacierEnv c gc u
let cmd = (proc "glacier" (toCommand params)) { env = Just e }
{ std_in = CreatePipe }
in liftIO $ withCreateProcess cmd (go' cmd)
go' cmd (Just hin) _ _ pid =
forceSuccessProcess cmd pid
`after`
go' cmd (Just hin) _ _ pid = do
meteredWrite p hin b
hClose hin
forceSuccessProcess cmd pid
go' _ _ _ _ _ = error "internal"
retrieve :: Remote -> Retriever