(data)
| 149 | args = PROGRAM_CAT |
| 150 | |
| 151 | async def run(data): |
| 152 | proc = await asyncio.create_subprocess_exec( |
| 153 | *args, |
| 154 | stdin=subprocess.PIPE, |
| 155 | stdout=subprocess.PIPE, |
| 156 | ) |
| 157 | |
| 158 | # feed data |
| 159 | proc.stdin.write(data) |
| 160 | await proc.stdin.drain() |
| 161 | proc.stdin.close() |
| 162 | |
| 163 | # get output and exitcode |
| 164 | data = await proc.stdout.read() |
| 165 | exitcode = await proc.wait() |
| 166 | return (exitcode, data) |
| 167 | |
| 168 | task = run(b'some data') |
| 169 | task = asyncio.wait_for(task, 60.0) |
no test coverage detected