Skip to content

Commit

Permalink
Add exception when maven subprocess raises error (#182)
Browse files Browse the repository at this point in the history
Signed-off-by: Jiyeong Seok <[email protected]>
  • Loading branch information
dd-jy authored Dec 21, 2023
1 parent 7faab9b commit 6065878
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/fosslight_dependency/package_manager/Maven.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,16 @@ def run_maven_plugin(self):
logger.error(f"Failed to run maven plugin: {cmd}")

cmd = f"{cmd_mvn} dependency:tree"
ret_txt = subprocess.check_output(cmd, text=True, shell=True)
if ret_txt is not None:
self.parse_dependency_tree(ret_txt)
self.set_direct_dependencies(True)
else:
logger.error(f"Failed to run: {cmd}")
try:
ret_txt = subprocess.check_output(cmd, text=True, shell=True)
if ret_txt is not None:
self.parse_dependency_tree(ret_txt)
self.set_direct_dependencies(True)
else:
logger.error(f"Failed to run: {cmd}")
self.set_direct_dependencies(False)
except Exception as e:
logger.error(f"Failed to run '{cmd}': {e}")
self.set_direct_dependencies(False)

def create_dep_stack(self, dep_line):
Expand Down

0 comments on commit 6065878

Please sign in to comment.