|
|
|
@ -5,6 +5,7 @@ from abc import ABC, abstractmethod
|
|
|
|
|
from typing import Optional, Union
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
from os import environ
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
|
|
# TODO: jem, zam - 2023_04_18: Discuss if we can move more functionality to domain?
|
|
|
|
|
class FileHandler(ABC):
|
|
|
|
@ -185,6 +186,7 @@ class SystemApi():
|
|
|
|
|
def __init__(self):
|
|
|
|
|
self.stdout = [""]
|
|
|
|
|
self.stderr = [""]
|
|
|
|
|
self.exitcode = 0
|
|
|
|
|
|
|
|
|
|
def run(self, args: list[str]):
|
|
|
|
|
sanitized_args = []
|
|
|
|
@ -206,9 +208,14 @@ class SystemApi():
|
|
|
|
|
else:
|
|
|
|
|
self.stderr = None
|
|
|
|
|
|
|
|
|
|
self.exitcode = stream.returncode
|
|
|
|
|
|
|
|
|
|
def run_checked(self, *args):
|
|
|
|
|
self.run(args)
|
|
|
|
|
|
|
|
|
|
logging.warning(f"err: {self.stderr}")
|
|
|
|
|
logging.warning(f"exit: {self.exitcode}")
|
|
|
|
|
|
|
|
|
|
if len(self.stderr) > 0:
|
|
|
|
|
raise Exception(f"Command failed with: {self.stderr}")
|
|
|
|
|
|
|
|
|
|