[Fuego] [fuego-core 1/7] ftc: docker ps will not work on the local board

[email protected] Sun, 18 Jul 2021 16:40:06 +0530
Newsgroups dev.linux.lists.fuego
Message-ID <[email protected]>
From: Daniel Sangorrin <[email protected]>

When running fuego directly on the local board, instead of
using a host-target approach, the check for a fuego
container caused an error.

Signed-off-by: Daniel Sangorrin <[email protected]>
Signed-off-by: venkata pyla <[email protected]>
---
 scripts/ftc | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/scripts/ftc b/scripts/ftc
index 4430dd2..2a6a640 100755
--- a/scripts/ftc
+++ b/scripts/ftc
@@ -5153,11 +5153,15 @@ def get_running_fuego_container_name():
         return cached_container_name
 
     # return the first container with "fuego" in the image or container name
-    dps_lines = subprocess.check_output("sudo docker ps", shell=True).split('\n')
-    for line in dps_lines:
-        if "fuego" in line:
-            cached_container_name = line.strip().split(" ")[-1]
-            break
+    try:
+        with open(os.devnull, 'w') as devnull:
+            dps_lines = subprocess.check_output("sudo docker ps", shell=True, stderr=devnull).split('\n')
+        for line in dps_lines:
+            if "fuego" in line:
+                cached_container_name = line.strip().split(" ")[-1]
+                break
+    except subprocess.CalledProcessError:
+        return None
 
     return cached_container_name
 
-- 
2.20.1