(data)
| 118 | args = PROGRAM_CAT |
| 119 | |
| 120 | async def run(data): |
| 121 | proc = await asyncio.create_subprocess_exec( |
| 122 | *args, |
| 123 | stdin=subprocess.PIPE, |
| 124 | stdout=subprocess.PIPE, |
| 125 | ) |
| 126 | |
| 127 | # feed data |
| 128 | proc.stdin.write(data) |
| 129 | await proc.stdin.drain() |
| 130 | proc.stdin.close() |
| 131 | |
| 132 | # get output and exitcode |
| 133 | data = await proc.stdout.read() |
| 134 | exitcode = await proc.wait() |
| 135 | return (exitcode, data) |
| 136 | |
| 137 | task = run(b'some data') |
| 138 | task = asyncio.wait_for(task, 60.0) |
no test coverage detected