Something
public text v1 · immutableimport subprocess
def open_pipe(command):
dataobject = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = dataobject.communicate()
if out: return out
if err: return err
lines = open_pipe(["aptitude", "update"]).split("\n")
for line in lines:
line = line.lower()
print line
if line.startswith("err") or "failed" in line or "failure" in line:
pass
This is for detecting possible errors, so I could repeat the process if needed.