Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions packages/helpermodules/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,16 +963,17 @@ def __enter__(self):
return None

def __exit__(self, exception_type, exception, exception_traceback) -> bool:
if isinstance(exception, Exception):
if isinstance(exception, subprocess.CalledProcessError):
pub_user_message(self.payload, self.connection_id,
f'Es ist ein interner Fehler aufgetreten: {exception}', MessageType.ERROR)
log.error({traceback.format_exc()})
(f'Fehler-Status: {exception.returncode}<br />Meldung: '
f'{exception.stderr if exception.stderr else ""} '
f'{exception.output if exception.output else ""}'),
MessageType.ERROR)
return True
elif isinstance(exception, subprocess.CalledProcessError):
log.debug(exception.stdout)
elif isinstance(exception, Exception):
pub_user_message(self.payload, self.connection_id,
f'Fehler-Status: {exception.returncode}<br />Meldung: {exception.stderr}',
MessageType.ERROR)
f'Es ist ein interner Fehler aufgetreten: {exception}', MessageType.ERROR)
log.error({traceback.format_exc()})
return True
else:
return False
Expand Down
6 changes: 4 additions & 2 deletions packages/helpermodules/utils/run_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ def run_command(command, process_exception: bool = False):
return result.stdout
except subprocess.CalledProcessError as e:
if process_exception:
log.debug(e.stdout)
log.exception(e.stderr)
if e.output is not None:
log.exception(e.output)
if e.stderr is not None:
log.exception(e.stderr)
else:
raise e