Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BufferMode not preserved when handle goes through silence/capture #19

Open
mitchellwrosen opened this issue Jan 30, 2014 · 2 comments
Open

Comments

@mitchellwrosen
Copy link

This is probably a rare use case, but maybe one you didn't consider. I have a commandline app that sets stdout to NoBuffering in main. If I launch an external process and wish to silence it, I have to reset the BufferMode. Here's my workaround:

hSilence' :: [Handle] -> IO a -> IO a
hSilence' hs action = do
    bs <- mapM hGetBuffering hs
    result <- hSilence hs action
    mapM_ (\(h,b) -> hSetBuffering h b) (zip hs bs)
    return result
@hesselink
Copy link

Thanks for reporting this! I just ran into this issue as well, but with stderr, which is not buffered by default. It actually caused a deadlock in my app somehow, I think.

@soenkehahn
Copy link
Contributor

Fixed and released to hackage as 1.2.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants