mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-08-27 03:42:49 +00:00
Polish macOS crash helper
This commit is contained in:
parent
4887d6ba14
commit
e9aed5a92f
1 changed files with 8 additions and 6 deletions
14
.github/workflows/macos_crash_report.py
vendored
14
.github/workflows/macos_crash_report.py
vendored
|
|
@ -256,12 +256,17 @@ class CrashReportBase:
|
|||
|
||||
|
||||
class UserModeCrashReport(CrashReportBase):
|
||||
ATOS_TIMEOUT_SECONDS = 10
|
||||
LOCAL_IMAGE_DIRS = (
|
||||
'build/kitty',
|
||||
'kitty/launcher',
|
||||
'kitty.app/Contents/MacOS',
|
||||
)
|
||||
|
||||
def __init__(self, metadata: Mapping, data: str, filename: str = None):
|
||||
self._symbolication_errors: set[str] = set()
|
||||
super().__init__(metadata, data, filename)
|
||||
|
||||
@cached_property
|
||||
def atos(self) -> Optional[str]:
|
||||
return shutil.which('atos')
|
||||
|
|
@ -276,16 +281,13 @@ class UserModeCrashReport(CrashReportBase):
|
|||
for entry in os.scandir(abspath):
|
||||
if entry.is_file():
|
||||
prev = result.get(entry.name)
|
||||
if prev is None or os.path.getmtime(entry.path) >= os.path.getmtime(prev):
|
||||
if prev is None or os.path.getmtime(entry.path) > os.path.getmtime(prev):
|
||||
result[entry.name] = entry.path
|
||||
return result
|
||||
|
||||
@property
|
||||
def symbolication_errors(self) -> set[str]:
|
||||
ans = getattr(self, '_symbolication_errors', None)
|
||||
if ans is None:
|
||||
ans = self._symbolication_errors = set()
|
||||
return ans
|
||||
return self._symbolication_errors
|
||||
|
||||
def _parse_field(self, name: str) -> str:
|
||||
name += ':'
|
||||
|
|
@ -305,7 +307,7 @@ class UserModeCrashReport(CrashReportBase):
|
|||
try:
|
||||
cp = subprocess.run(
|
||||
[self.atos, '-o', local_image, '-l', hex(frame.image_base), hex(address)],
|
||||
capture_output=True, text=True, timeout=10
|
||||
capture_output=True, text=True, timeout=self.ATOS_TIMEOUT_SECONDS
|
||||
)
|
||||
except subprocess.TimeoutExpired:
|
||||
self.symbolication_errors.add(f'{os.path.basename(local_image)}: atos timed out')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue