@@ -312,6 +312,7 @@ def run_perf(cwd, *args, use_jit=False, **env_vars):
312
312
stdout = subprocess .PIPE ,
313
313
stderr = subprocess .PIPE ,
314
314
env = env ,
315
+ text = True ,
315
316
)
316
317
if proc .returncode :
317
318
print (proc .stderr , file = sys .stderr )
@@ -321,10 +322,10 @@ def run_perf(cwd, *args, use_jit=False, **env_vars):
321
322
jit_output_file = cwd + "/jit_output.dump"
322
323
command = ("perf" , "inject" , "-j" , "-i" , output_file , "-o" , jit_output_file )
323
324
proc = subprocess .run (
324
- command , stderr = subprocess .PIPE , stdout = subprocess .PIPE , env = env
325
+ command , stderr = subprocess .PIPE , stdout = subprocess .PIPE , env = env , text = True
325
326
)
326
327
if proc .returncode :
327
- print (proc .stderr )
328
+ print (proc .stderr , file = sys . stderr )
328
329
raise ValueError (f"Perf failed with return code { proc .returncode } " )
329
330
# Copy the jit_output_file to the output_file
330
331
os .rename (jit_output_file , output_file )
@@ -336,10 +337,9 @@ def run_perf(cwd, *args, use_jit=False, **env_vars):
336
337
stderr = subprocess .PIPE ,
337
338
env = env ,
338
339
check = True ,
340
+ text = True ,
339
341
)
340
- return proc .stdout .decode ("utf-8" , "replace" ), proc .stderr .decode (
341
- "utf-8" , "replace"
342
- )
342
+ return proc .stdout , proc .stderr
343
343
344
344
345
345
class TestPerfProfilerMixin :
0 commit comments