Create a process in the same way as popen_sp, but patch the file descriptors so they can be accessed from Python/gevent in a non-blocking manner.
(*args, **kwargs)
| 71 | |
| 72 | |
| 73 | def popen_nonblock(*args, **kwargs): |
| 74 | """ |
| 75 | Create a process in the same way as popen_sp, but patch the file |
| 76 | descriptors so they can be accessed from Python/gevent |
| 77 | in a non-blocking manner. |
| 78 | """ |
| 79 | |
| 80 | proc = popen_sp(*args, **kwargs) |
| 81 | |
| 82 | if proc.stdin: |
| 83 | proc.stdin = pipebuf.NonBlockBufferedWriter(proc.stdin) |
| 84 | |
| 85 | if proc.stdout: |
| 86 | proc.stdout = pipebuf.NonBlockBufferedReader(proc.stdout) |
| 87 | |
| 88 | if proc.stderr: |
| 89 | proc.stderr = pipebuf.NonBlockBufferedReader(proc.stderr) |
| 90 | |
| 91 | return proc |
| 92 | |
| 93 | |
| 94 | def pipe(*args): |