MCPcopy Index your code
hub / github.com/python/cpython / run

Method run

Lib/test/test_asyncio/test_subprocess.py:151–166  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

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)

Calls 6

writeMethod · 0.45
drainMethod · 0.45
closeMethod · 0.45
readMethod · 0.45
waitMethod · 0.45
communicateMethod · 0.45

Tested by

no test coverage detected