Show More
@@ -1,6 +1,9 b'' | |||
|
1 | import os, stat | |
|
1 | import errno | |
|
2 | import os | |
|
2 | 3 | import re |
|
3 | 4 | import socket |
|
5 | import stat | |
|
6 | import subprocess | |
|
4 | 7 | import sys |
|
5 | 8 | import tempfile |
|
6 | 9 | |
@@ -69,14 +72,16 b' def matchoutput(cmd, regexp, ignorestatu' | |||
|
69 | 72 | is matched by the supplied regular expression. |
|
70 | 73 | """ |
|
71 | 74 | r = re.compile(regexp) |
|
72 | fh = os.popen(cmd) | |
|
73 | s = fh.read() | |
|
74 | 75 | try: |
|
75 | ret = fh.close() | |
|
76 | except IOError: | |
|
77 | # Happen in Windows test environment | |
|
78 | ret = 1 | |
|
79 | return (ignorestatus or ret is None) and r.search(s) | |
|
76 | p = subprocess.Popen( | |
|
77 | cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | |
|
78 | except OSError as e: | |
|
79 | if e.errno != errno.ENOENT: | |
|
80 | raise | |
|
81 | ret = -1 | |
|
82 | ret = p.wait() | |
|
83 | s = p.stdout.read() | |
|
84 | return (ignorestatus or not ret) and r.search(s) | |
|
80 | 85 | |
|
81 | 86 | @check("baz", "GNU Arch baz client") |
|
82 | 87 | def has_baz(): |
General Comments 0
You need to be logged in to leave comments.
Login now