Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async def subproc(ctx):
- if len(ctx.message.content.split()) > 1:
- # output = asyncio.create_subprocess_shell(message.content[3:],
- # shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
- output = subprocess.Popen(ctx.message.content[3:], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- while output is not None:
- retcode = output.poll()
- if retcode is not None:
- # done
- return output.communicate()[0].decode()
- break
- else:
- # still running
- await asyncio.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement