问了两个GPT
第一个给出的是
import asyncio
import subprocess
async def read_output(process):
while True:
output = await process.stdout.readline()
if output == b'' and process.poll() is not None:
break
if output:
print(output.decode('utf-8').strip())
async def main():
process = await asyncio.create_subprocess_exec(
'cmd',
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
creationflags=subprocess.CREATE_NO_WINDOW
)
await asyncio.gather(
read_output(process),
process.stdin.write(b'input\n'),
process.stdin.drain(),
process.wait()
)
asyncio.run(main())
运行直接报错
--
FROM 101.24.89.*