This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Marc.Abramowitz
Recipients Marc.Abramowitz, alex, barry, belopolsky, brett.cannon, ncoghlan, pitrou, rhettinger, vstinner
Date 2013-07-20.01:45:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
As it happens, I wrote a similar context manager to Victor's recently for a because I wanted to suppress compiler errors that are output to the console by distutils.ccompiler.CCompiler.has_function. As Victor mentioned, for this to work with subprocesses, you need to go a little more low-level and mess around with file descriptors. Here's my function:

(Maybe distutils.ccompiler.CCompiler.has_function should redirect its own output automatically, but that's another issue)

But then I got to thinking that it could be made a bit more powerful and the syntax could be a little nicer. So I have this code that I'm experimenting with:

But critiquing my own function, I wonder if it's trying to do too much in one function and it's using keyword arguments where it could be using the with statement better. So I might like Nick's API better.
Date User Action Args
2013-07-20 01:45:51Marc.Abramowitzsetrecipients: + Marc.Abramowitz, barry, brett.cannon, rhettinger, ncoghlan, belopolsky, pitrou, vstinner, alex
2013-07-20 01:45:51Marc.Abramowitzsetmessageid: <>
2013-07-20 01:45:51Marc.Abramowitzlinkissue15805 messages
2013-07-20 01:45:50Marc.Abramowitzcreate