@@ -318,6 +318,7 @@ def run_perf(cwd, *args, use_jit=False, **env_vars):
318
318
stdout = subprocess .PIPE ,
319
319
stderr = subprocess .PIPE ,
320
320
env = env ,
321
+ text = True ,
321
322
)
322
323
if proc .returncode :
323
324
print (proc .stderr , file = sys .stderr )
@@ -327,10 +328,10 @@ def run_perf(cwd, *args, use_jit=False, **env_vars):
327
328
jit_output_file = cwd + "/jit_output.dump"
328
329
command = ("perf" , "inject" , "-j" , "-i" , output_file , "-o" , jit_output_file )
329
330
proc = subprocess .run (
330
- command , stderr = subprocess .PIPE , stdout = subprocess .PIPE , env = env
331
+ command , stderr = subprocess .PIPE , stdout = subprocess .PIPE , env = env , text = True
331
332
)
332
333
if proc .returncode :
333
- print (proc .stderr )
334
+ print (proc .stderr , file = sys . stderr )
334
335
raise ValueError (f"Perf failed with return code { proc .returncode } " )
335
336
# Copy the jit_output_file to the output_file
336
337
os .rename (jit_output_file , output_file )
@@ -342,10 +343,9 @@ def run_perf(cwd, *args, use_jit=False, **env_vars):
342
343
stderr = subprocess .PIPE ,
343
344
env = env ,
344
345
check = True ,
346
+ text = True ,
345
347
)
346
- return proc .stdout .decode ("utf-8" , "replace" ), proc .stderr .decode (
347
- "utf-8" , "replace"
348
- )
348
+ return proc .stdout , proc .stderr
349
349
350
350
351
351
class TestPerfProfilerMixin :
0 commit comments