aboutsummaryrefslogtreecommitdiff
path: root/contrib/scripts/gnunet_pyexpect.py.in
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/scripts/gnunet_pyexpect.py.in')
-rw-r--r--contrib/scripts/gnunet_pyexpect.py.in20
1 files changed, 15 insertions, 5 deletions
diff --git a/contrib/scripts/gnunet_pyexpect.py.in b/contrib/scripts/gnunet_pyexpect.py.in
index 188436f51..48f8acdc1 100644
--- a/contrib/scripts/gnunet_pyexpect.py.in
+++ b/contrib/scripts/gnunet_pyexpect.py.in
@@ -11,7 +11,7 @@
11# WITHOUT ANY WARRANTY; without even the implied warranty of 11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# Affero General Public License for more details. 13# Affero General Public License for more details.
14# 14#
15# You should have received a copy of the GNU Affero General Public License 15# You should have received a copy of the GNU Affero General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>. 16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17# 17#
@@ -27,7 +27,7 @@ import shutil
27import time 27import time
28 28
29 29
30class pexpect (object): 30class pexpect(object):
31 def __init__(self): 31 def __init__(self):
32 super(pexpect, self).__init__() 32 super(pexpect, self).__init__()
33 33
@@ -54,12 +54,22 @@ class pexpect (object):
54 if len(stream) == 0: 54 if len(stream) == 0:
55 return True 55 return True
56 else: 56 else:
57 print("Failed to find `{1}' in {0}, which is `{2}' ({3})".format(s, r, stream, len(stream))) 57 print(
58 "Failed to find `{1}' in {0}, which is `{2}' ({3})".
59 format(s, r, stream, len(stream))
60 )
58 sys.exit(2) 61 sys.exit(2)
59 raise ValueError("Argument `r' should be an instance of re.RegexObject or a special string, but is `{0}'".format(r)) 62 raise ValueError(
63 "Argument `r' should be an instance of re.RegexObject or a special string, but is `{0}'"
64 .format(r)
65 )
60 m = r.search(stream.decode(), flags) 66 m = r.search(stream.decode(), flags)
61 if not m: 67 if not m:
62 print("Failed to find `{1}' in {0}, which is is `{2}'".format(s, r.pattern, stream)) 68 print(
69 "Failed to find `{1}' in {0}, which is is `{2}'".format(
70 s, r.pattern, stream
71 )
72 )
63 sys.exit(2) 73 sys.exit(2)
64 stream = stream[m.end():] 74 stream = stream[m.end():]
65 if s == 'stdout': 75 if s == 'stdout':