Update generic_utils.py (#3561)

Handles cases when git branch produces no output or invalid output. Right now, it just crashes with `StopIteration`
dev
Nick Potafiy 2024-02-10 09:20:58 -05:00 committed by GitHub
parent 5dcc16d193
commit dbf1a08a0d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 3 deletions

View File

@ -36,9 +36,7 @@ def get_git_branch():
current.replace("* ", "")
except subprocess.CalledProcessError:
current = "inside_docker"
except FileNotFoundError:
current = "unknown"
except StopIteration:
except (FileNotFoundError, StopIteration) as e:
current = "unknown"
return current