Skip to content

Commit 833a299

Browse files
committed
[test] Remove decode_output argument to shared.run_process. NFC
1 parent 16f7f8d commit 833a299

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

scripts/test/shared.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -302,15 +302,11 @@ def remove_readonly_and_try_again(func, path, exc_info):
302302
pass
303303

304304

305-
def run_process(cmd, check=True, input=None, decode_output=True, *args, **kw):
306-
if input and type(input) is str:
307-
input = bytes(input, 'utf-8')
308-
ret = subprocess.run(cmd, check=check, input=input, *args, **kw)
309-
if decode_output and ret.stdout is not None:
310-
ret.stdout = ret.stdout.decode('utf-8')
311-
if ret.stderr is not None:
312-
ret.stderr = ret.stderr.decode('utf-8')
313-
return ret
305+
def run_process(cmd, check=True, text=True, *args, **kw):
306+
"""Trivial wrapper around subprocess.run that defaults to check=True and
307+
text=True
308+
"""
309+
return subprocess.run(cmd, check=check, text=text, *args, **kw)
314310

315311

316312
def fail_with_error(msg):

test/unit/test_features.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,8 @@ def test_explicit_detect_features(self):
422422
def test_emit_all_features(self):
423423
p = shared.run_process(shared.WASM_OPT +
424424
['--emit-target-features', '-all', '-o', '-'],
425-
input="(module)", check=False,
426-
capture_output=True, decode_output=False)
425+
input=b"(module)", check=False, text=False,
426+
capture_output=True)
427427
self.assertEqual(p.returncode, 0)
428428
p2 = shared.run_process(shared.WASM_OPT +
429429
['--print-features', '-o', os.devnull],

0 commit comments

Comments
 (0)