From ee3766644af30cb42d4be0db07ff82f1a1ff5639 Mon Sep 17 00:00:00 2001 From: Markus Siemens Date: Sat, 5 Oct 2024 21:48:29 +0200 Subject: [PATCH] fix: make `run_cmd` more robust --- PyGitUp/git_wrapper.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PyGitUp/git_wrapper.py b/PyGitUp/git_wrapper.py index ac191e9..40d4181 100644 --- a/PyGitUp/git_wrapper.py +++ b/PyGitUp/git_wrapper.py @@ -235,8 +235,9 @@ def run_cmd(cmd: GitCmd.AutoInterrupt) -> bytes: error.status ) - raise GitError(message, stderr=error.stderr, stdout=std_outs[0]) - return std_outs[0].strip() + raise GitError(message, stderr=error.stderr, stdout=std_outs[0] if std_outs else None) + + return std_outs[0].strip() if std_outs else bytes() def config(self, key): """ Return `git config key` output or None. """