Index: tools/bots/bot_utils.py |
diff --git a/tools/bots/bot_utils.py b/tools/bots/bot_utils.py |
index 1feaf2c136af693a83f85ff4ddff2457d3e39ed9..d92f4271f88d13a7fbc0f5b3269fe579ae0b5c6f 100644 |
--- a/tools/bots/bot_utils.py |
+++ b/tools/bots/bot_utils.py |
@@ -12,6 +12,13 @@ import string |
import subprocess |
import sys |
+# The resource package does not exist on Windows but its functionality is not |
+# used there, either. |
+try: |
+ import resource |
+except ImportError: |
+ resource = None; |
+ |
DART_DIR = os.path.abspath( |
os.path.normpath(os.path.join(__file__, '..', '..', '..'))) |
@@ -365,3 +372,14 @@ def GetChannelFromName(name): |
if channel_name in Channel.ALL_CHANNELS: |
return channel_name |
return Channel.BLEEDING_EDGE |
+ |
+class CoredumpEnabler(object): |
+ def __init__(self): |
+ self._old_limits = None |
+ |
+ def __enter__(self): |
+ self._old_limits = resource.getrlimit(resource.RLIMIT_CORE) |
+ resource.setrlimit(resource.RLIMIT_CORE, (-1, -1)) |
+ |
+ def __exit__(self, *_): |
+ resource.setrlimit(resource.RLIMIT_CORE, self._old_limits) |