From d4fe6bab82b6e30ea4076f212893c9e45ca83bca Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Thu, 13 Jun 2024 13:43:03 -0500 Subject: [PATCH] Also catch FileNotFoundError when detecting multiarch (#159) When the executable we're trying to invoke doesn't exist at all, we'll see a FileNotFoundError and not a subprocess.CalledProcessError. --- colcon_ros/task/cmake/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/colcon_ros/task/cmake/__init__.py b/colcon_ros/task/cmake/__init__.py index 5663608..416f071 100644 --- a/colcon_ros/task/cmake/__init__.py +++ b/colcon_ros/task/cmake/__init__.py @@ -44,7 +44,7 @@ def get_multiarch(): if _multiarch is None: try: output = subprocess.check_output(['gcc', '-print-multiarch']) - except subprocess.CalledProcessError: + except (FileNotFoundError, subprocess.CalledProcessError): pass else: _multiarch = output.decode().rstrip() @@ -52,7 +52,7 @@ def get_multiarch(): try: output = subprocess.check_output( ['dpkg-architecture', '-qDEB_HOST_MULTIARCH']) - except subprocess.CalledProcessError: + except (FileNotFoundError, subprocess.CalledProcessError): pass else: _multiarch = output.decode().rstrip()