diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index c6a1daf8..7fadcd29 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -6,9 +6,9 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - name: install tox diff --git a/lib/vsc/utils/run.py b/lib/vsc/utils/run.py index e3da4509..22879088 100644 --- a/lib/vsc/utils/run.py +++ b/lib/vsc/utils/run.py @@ -160,12 +160,14 @@ def __init__(self, cmd=None, **kwargs): @param use_shell: use the subshell @param shell: change the shell @param env: environment settings to pass on + @param post_exitcode: log errors on non zero exitcode (debug otherwise) """ self.input = kwargs.pop('input', None) self.startpath = kwargs.pop('startpath', None) self.use_shell = kwargs.pop('use_shell', self.USE_SHELL) self.shell = kwargs.pop('shell', self.SHELL) self.env = kwargs.pop('env', None) + self.post_exitcode = kwargs.pop('post_exitcode', True) if kwargs.pop('disable_log', None): self.log = DummyFunction() # No logging @@ -440,8 +442,14 @@ def _post_exitcode(self): cmd_ascii = ensure_ascii_string(self.cmd) if not self._process_exitcode == 0: shell_cmd_ascii = ensure_ascii_string(self._shellcmd) - self._post_exitcode_log_failure("_post_exitcode: problem occured with cmd %s: (shellcmd %s) output %s", - cmd_ascii, shell_cmd_ascii, self._process_output) + message = ( + f"_post_exitcode: problem occured with cmd {cmd_ascii}:" + f"(shellcmd {shell_cmd_ascii}) output {self._process_output}" + ) + if self.post_exitcode: + self._post_exitcode_log_failure(message) + else: + self.log.debug(message) else: self.log.debug("_post_exitcode: success cmd %s: output %s", cmd_ascii, self._process_output) @@ -763,7 +771,6 @@ def _read_process(self, readsize=None): class RunNoShellFile(RunNoShell, RunFile): """Popen to filehandle""" - class RunPty(Run): """Pty support (eg for screen sessions)""" def _read_process(self, readsize=None): diff --git a/setup.py b/setup.py index 8c5bf515..3be054b2 100755 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ from vsc.install.shared_setup import ag, kh, jt, sdw, wdp PACKAGE = { - 'version': '3.6.1', + 'version': '3.6.2', 'author': [sdw, jt, ag, kh], 'maintainer': [sdw, jt, ag, kh, wdp], 'install_requires': [