All pastes #119366 Raw Edit

Something

public text v1 · immutable
·published 2006-08-06 20:22 UTC
rendered paste body
import 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.