Created
November 16, 2013 01:03
-
-
Save dlai0001/7494459 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Created on Nov 15, 2013 | |
@author: "David Lai" | |
''' | |
import shlex, subprocess | |
if __name__ == '__main__': | |
command_line = "ls" | |
args = shlex.split(command_line) | |
print args | |
proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # Success! | |
while True: | |
was_there_lines = False | |
lines = proc.stdout.readlines() | |
for line in lines: | |
was_there_lines = True | |
print line | |
#if "Executing: [delete session:" in line: | |
if "ghostdriver.log" in line: | |
# Kill the selenium node process, then reboot. | |
print "Session delete detected. Killing terminating and rebooting this node." | |
proc.terminate() | |
if len(lines) > 0: | |
continue | |
if proc.poll() is not None: | |
break | |
print "rebooting the system." | |
# DOSTUFF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment