(0, self.old_value[1]))
except (ValueError, OSError):
pass
+
if sys.platform == 'darwin':
# Check if the 'Crash Reporter' on OSX was configured
# in 'Developer' mode and warn that it will get triggered
#
# This assumes that this context manager is used in tests
# that might trigger the next manager.
- value = subprocess.Popen(['/usr/bin/defaults', 'read',
- 'com.apple.CrashReporter', 'DialogType'],
- stdout=subprocess.PIPE).communicate()[0]
- if value.strip() == b'developer':
+ cmd = ['/usr/bin/defaults', 'read',
+ 'com.apple.CrashReporter', 'DialogType']
+ proc = subprocess.Popen(cmd,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ with proc:
+ stdout = proc.communicate()[0]
+ if stdout.strip() == b'developer':
print("this test triggers the Crash Reporter, "
"that is intentional", end='', flush=True)
import sys
import time
import threading
+ from test.support import SuppressCrashReport
file = sys.{stream_name}
file.write('.')
file.flush()
+ crash = SuppressCrashReport()
+ crash.__enter__()
+ # don't call __exit__(): the crash occurs at Python shutdown
+
thread = threading.Thread(target=run)
thread.daemon = True
thread.start()