Skip to content

Commit bc587d9

Browse files
Marti Bolivarnashif
authored andcommitted
scripts: west: add subprocess.call wrapper to runner classes
There's a use case for it in intel_s1000.py Signed-off-by: Marti Bolivar <[email protected]>
1 parent a81f055 commit bc587d9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

scripts/meta/west/runner/core.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,21 @@ def run_server_and_client(self, server, client):
397397
server_proc.terminate()
398398
server_proc.wait()
399399

400+
def call(self, cmd):
401+
'''Subclass subprocess.call() wrapper.
402+
403+
Subclasses should use this method to run command in a
404+
subprocess and get its return code, rather than
405+
using subprocess directly, to keep accurate debug logs.
406+
'''
407+
if DEBUG or self.debug:
408+
print(quote_sh_list(cmd))
409+
410+
if DEBUG:
411+
return 0
412+
413+
return subprocess.call(cmd)
414+
400415
def check_call(self, cmd):
401416
'''Subclass subprocess.check_call() wrapper.
402417

0 commit comments

Comments
 (0)