mirror of
https://github.com/samba-team/samba.git
synced 2025-07-31 20:22:15 +03:00
pytest:segfault: do not assume PLEASE_NO_GDB_BACKTRACE var is unset
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
committed by
Andrew Bartlett
parent
5ceecd3f73
commit
c17ff0a335
@ -58,11 +58,15 @@ def segfault_detector(f):
|
||||
def no_gdb_backtrace(f):
|
||||
from os import environ
|
||||
def w(*args, **kwargs):
|
||||
environ['PLEASE_NO_GDB_BACKTRACE'] = '1'
|
||||
old = environ.get('PLEASE_NO_GDB_BACKTRACE')
|
||||
environ['PLEASE_NO_GDB_BACKTRACE'] = '1'
|
||||
try:
|
||||
f(*args, **kwargs)
|
||||
finally:
|
||||
del environ['PLEASE_NO_GDB_BACKTRACE']
|
||||
if old is not None:
|
||||
environ['PLEASE_NO_GDB_BACKTRACE'] = old
|
||||
else:
|
||||
del environ['PLEASE_NO_GDB_BACKTRACE']
|
||||
|
||||
return w
|
||||
|
||||
|
Reference in New Issue
Block a user