Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. import subprocess
  2.  
  3.  
  4. class Process:
  5. p = None
  6. exit_code = None
  7.  
  8. def __init__(self, command):
  9. self.command = command
  10.  
  11. def run(self):
  12. p = subprocess.Popen(self.command.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
  13. while True:
  14. ret = p.poll()
  15. line = p.stdout.readline()
  16. yield line
  17. if ret is not None:
  18. self.exit_code = ret
  19. break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement