1

Building upon this previous question: Timeout function if it takes too long to finish, I have to use a closed-source library that doesn't use timeouts in its calls to requests (and doesn't accept a timeout parameter). The function I'm calling outputs directly to stdout.

Instead of monkey-patching the library, I'd like to wrap the function call in such a way that stdout is monitored for changes. If stdout doesn't receive an input within X seconds, a TimeoutError is raised.

How do I go about doing this?

I'll Eat My Hat
  • 1,150
  • 11
  • 20

0 Answers0