Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74d1173
commit 9cc6f17
Showing
2 changed files
with
59 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/python | ||
import subprocess, time | ||
|
||
def run_command(cmd): | ||
"""Execute a shell command and return the output | ||
:param command: the command to be run and all of the arguments | ||
:returns: success_boolean, command_string, stdout, stderr | ||
""" | ||
|
||
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
for line in iter(proc.stdout.readline, b''): | ||
print(">>> " + line.rstrip()) | ||
(stdout, stderr) = proc.communicate() | ||
return proc.returncode == 0, proc | ||
|
||
def main(): | ||
cmd = "bash travis.sh -n" | ||
for i in range(0, 50): | ||
print"Running loop {}".format(i+1) | ||
success, proc = run_command(cmd) | ||
if not success: | ||
for line in iter(proc.stderr.readline, b''): | ||
print("--- " + line.rstrip()) | ||
break | ||
else: | ||
print "...........................Success\n" | ||
time.sleep(30) | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains 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