Skip to content

Commit

Permalink
Suppress prompt spawned by subprocess when using pythonw
Browse files Browse the repository at this point in the history
  • Loading branch information
collinbanko committed Apr 9, 2021
1 parent 19fa43f commit 0f82f69
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 @@ -2,6 +2,7 @@
import linecache
import logging
import os
import platform
import sys
import threading
import subprocess
Expand Down Expand Up @@ -60,11 +61,17 @@ def get_default_release():
if release:
return release

startupinfo = None
if platform.system() == "Windows":
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW

with open(os.path.devnull, "w+") as null:
try:
release = (
subprocess.Popen(
["git", "rev-parse", "HEAD"],
startupinfo=startupinfo,
stdout=subprocess.PIPE,
stderr=null,
stdin=null,
Expand Down

0 comments on commit 0f82f69

Please sign in to comment.