MCPcopy Index your code
hub / github.com/RustPython/RustPython / run

Method run

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

Source from the content-addressed store, hash-verified

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)

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