Skip to content

Commit 44ea713

Browse files
Simplify passing a file to subprocess stdin
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
1 parent aebb1fa commit 44ea713

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

scripts/mbedtls_framework/psa_compliance.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import glob
1414
import os
1515
import re
16-
import shlex
1716
import shutil
1817
import subprocess
1918
import sys
@@ -64,9 +63,9 @@ def test_compliance(library_build_dir: str,
6463
if patch_files:
6564
subprocess.check_call(['git', 'reset', '--hard'])
6665
for patch_file in patch_files:
67-
abs_path = os.path.abspath(os.path.join(root_dir, patch_file))
68-
subprocess.check_call(['patch -p1 <' + shlex.quote(abs_path)],
69-
shell=True)
66+
with open(os.path.join(root_dir, patch_file), 'rb') as patch:
67+
subprocess.check_call(['patch', '-p1'],
68+
stdin=patch)
7069

7170
build_dir = 'api-tests/build'
7271
try:

0 commit comments

Comments
 (0)