Skip to content

Commit e50bfb6

Browse files
authored
Make sure command line is available before inspecting. (#187)
1 parent 14b9315 commit e50bfb6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

instana/log.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ def running_in_gunicorn():
3535
process_check = False
3636
package_check = False
3737

38-
for arg in sys.argv:
39-
if arg.find('gunicorn') >= 0:
40-
process_check = True
38+
if hasattr(sys, 'argv'):
39+
for arg in sys.argv:
40+
if arg.find('gunicorn') >= 0:
41+
process_check = True
42+
else:
43+
# We have no command line so rely on the gunicorn package presence entirely
44+
process_check = True
4145

4246
try:
4347
from gunicorn import glogging

0 commit comments

Comments
 (0)