From bc587d92629ef1079fd4e4e4674f4ce03fc3be82 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Wed, 9 May 2018 21:56:11 -0400 Subject: [PATCH] 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 --- scripts/meta/west/runner/core.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/meta/west/runner/core.py b/scripts/meta/west/runner/core.py index 70d4e80bc81..dc298851ea6 100644 --- a/scripts/meta/west/runner/core.py +++ b/scripts/meta/west/runner/core.py @@ -397,6 +397,21 @@ class ZephyrBinaryRunner(abc.ABC): server_proc.terminate() server_proc.wait() + def call(self, cmd): + '''Subclass subprocess.call() wrapper. + + Subclasses should use this method to run command in a + subprocess and get its return code, rather than + using subprocess directly, to keep accurate debug logs. + ''' + if DEBUG or self.debug: + print(quote_sh_list(cmd)) + + if DEBUG: + return 0 + + return subprocess.call(cmd) + def check_call(self, cmd): '''Subclass subprocess.check_call() wrapper.