@@ -78,18 +78,20 @@ def run_one(args, host, port, cafile=None):
78
78
raise ProcessFailed ("failed to launch the stub" , os .strerror (ose .errno ))
79
79
80
80
out , _ = process .communicate ()
81
+ out = out .decode ("ascii" , "replace" )
82
+
81
83
if process .returncode != 0 :
82
84
raise ProcessFailed ("stub exited with return code {}" .format (process .returncode ), out )
83
85
84
86
out = out .rstrip ()
85
87
lines = out .splitlines ()
86
88
if lines :
87
89
verdict = lines .pop ()
88
- if verdict == b "ACCEPT" :
90
+ if verdict == "ACCEPT" :
89
91
return True , "" .join (lines )
90
- elif verdict == b "REJECT" :
92
+ elif verdict == "REJECT" :
91
93
return False , "" .join (lines )
92
- elif verdict == b "UNSUPPORTED" :
94
+ elif verdict == "UNSUPPORTED" :
93
95
raise Unsupported ("" .join (lines ))
94
96
raise UnexpectedOutput (out )
95
97
@@ -138,10 +140,13 @@ def format(self, test, res):
138
140
accept = "accept" if test .accept else "reject"
139
141
)
140
142
141
- if res .reason .rstrip ():
142
- template += reset + self .base + "\n " + indent ("reason: " + self .reason + res .reason .rstrip (), by = 6 )
143
- if res .details .rstrip ():
144
- template += reset + self .base + "\n " + indent ("output: " , by = 6 ) + self .details + indent (res .details .rstrip (), by = 14 , first_line = False )
143
+ reason = res .reason .rstrip ()
144
+ if reason :
145
+ template += reset + self .base + "\n " + indent ("reason: " + self .reason + reason , by = 6 )
146
+
147
+ details = res .details .rstrip ()
148
+ if details :
149
+ template += reset + self .base + "\n " + indent ("output: " , by = 6 ) + self .details + indent (details , by = 14 , first_line = False )
145
150
146
151
return template
147
152
0 commit comments