8000 Suppress prompt spawned by subprocess when using pythonw (#2936) · au79stein/sentry-python@669ed17 · GitHub
[go: up one dir, main page]

Skip to content

Commit 669ed17

Browse files
Suppress prompt spawned by subprocess when using pythonw (getsentry#2936)
Co-authored-by: Collin Banko <me@collinbanko.com>
1 parent a113ec8 commit 669ed17

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

sentry_sdk/utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,16 @@ def get_git_revision():
106106
# type: () -> Optional[str]
107107
try:
108108
with open(os.path.devnull, "w+") as null:
109+
# prevent command prompt windows from popping up on windows
110+
startupinfo = None
111+
if sys.platform == "win32" or sys.platform == "cygwin":
112+
startupinfo = subprocess.STARTUPINFO()
113+
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
114+
109115
revision = (
110116
subprocess.Popen(
111117
["git", "rev-parse", "HEAD"],
118+
startupinfo=startupinfo,
112119
stdout=subprocess.PIPE,
113120
stderr=null,
114121
stdin=null,

0 commit comments

Comments
 (0)
0