Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
5,472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. async def subproc(ctx):
  2.     if len(ctx.message.content.split()) > 1:
  3.         # output = asyncio.create_subprocess_shell(message.content[3:],
  4.         # shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
  5.         output = subprocess.Popen(ctx.message.content[3:], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
  6.         while output is not None:
  7.             retcode = output.poll()
  8.             if retcode is not None:
  9.                 # done
  10.                 return output.communicate()[0].decode()
  11.                 break
  12.             else:
  13.                 # still running
  14.                 await asyncio.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement