Skip to content

Commit

Permalink
Close rpitx handle when done
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownloner committed Jul 26, 2017
1 parent 5ca0531 commit 51b2211
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions library/VaporTrail/FileWatcher.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ rpitxTransmit bytes = do
, Process.std_out = Process.CreatePipe
, Process.std_err = Process.CreatePipe
}
doProc (Just hin) (Just hout) (Just herr) procHandle = do
doProc (Just hin) (Just hout) (Just herr) procHandle =
Async.race_
(Async.race_
(IO.hGetContents hout >>= putStr)
(IO.hGetContents herr >>= IO.hPutStr IO.stderr))
(withUnbuffered hin (putRaw hin toneBytes))
void (Process.waitForProcess procHandle)
(do withUnbuffered hin (putRaw hin toneBytes)
IO.hFlush hin
IO.hClose hin
void (Process.waitForProcess procHandle))
doProc _ _ _ _ =
IO.hPutStrLn
IO.stderr
Expand Down

0 comments on commit 51b2211

Please sign in to comment.