Skip to content
Advertisement

Non-blocking pipe using popen?

I’d like to open a pipe using popen() and have non-blocking ‘read’ access to it.

How can I achieve this?

(The examples I found were all blocking/synchronous)

Advertisement

Answer

Setup like this:

JavaScript

Now you can read:

JavaScript

When you’re done, cleanup:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement