+ print label + ': ' + foldlines(res, numlines)
+ except EnvironmentError, e:
+ if isinstance(e, OSError) and e.errno == errno.ENOENT:
+ print str(label) + ': ' + str(cmdlist[0]) + ': no such file or directory'
+ return
+ sys.stderr.write("\n%s: Got exception invoking '%s'. Exception follows.\n" % (label, cmdlist[0],))
+ traceback.print_exc(file=sys.stderr)
+ sys.stderr.flush()
+ pass
+
+def print_stderr(cmdlist, label=None):
+ if label is None:
+ label = cmdlist[0]
+ try:
+ res = subprocess.Popen(cmdlist, stdin=open(os.devnull),
+ stderr=subprocess.PIPE).communicate()[1]