From aa709b7244670cbea883800e34b13fa757b4893b Mon Sep 17 00:00:00 2001 From: n3rada <72791564+n3rada@users.noreply.github.com> Date: Tue, 27 Feb 2024 22:34:04 +0100 Subject: [PATCH] one_shot_execute adjust --- toboggan/src/executor.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/toboggan/src/executor.py b/toboggan/src/executor.py index c61d84f..7fe367b 100644 --- a/toboggan/src/executor.py +++ b/toboggan/src/executor.py @@ -260,18 +260,21 @@ def execute(self, command: str, timeout: float = None, retry: bool = True) -> st return result - def one_shot_execute(self, command: str) -> str: + def one_shot_execute(self, command: str = None) -> None: """Execute a command without returning nothing and with a fast timeout. Args: command (str): Command to be executed. """ + if not command: + return + try: if self.__os_handler is not None and self.__obfuscation: command = self.__os_handler.prepare_command(command=command) - return self.__module.execute(command=command, timeout=1.5) - except: - pass + self.__module.execute(command=command, timeout=1.5) + except Exception: + return def is_alive(self) -> bool: """