Skip to content

Commit

Permalink
Suppress prompt spawned by subprocess when using pythonw (#2936)
Browse files Browse the repository at this point in the history
Co-authored-by: Collin Banko <[email protected]>
  • Loading branch information
antonpirker and collinbanko authored Apr 4, 2024
1 parent a113ec8 commit 669ed17
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sentry_sdk/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,16 @@ def get_git_revision():
# type: () -> Optional[str]
try:
with open(os.path.devnull, "w+") as null:
# prevent command prompt windows from popping up on windows
startupinfo = None
if sys.platform == "win32" or sys.platform == "cygwin":
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW

revision = (
subprocess.Popen(
["git", "rev-parse", "HEAD"],
startupinfo=startupinfo,
stdout=subprocess.PIPE,
stderr=null,
stdin=null,
Expand Down

0 comments on commit 669ed17

Please sign in to comment.