(core_mask)
| 44 | default_pattern = CoreFilePattern(cwd, '*') |
| 45 | |
| 46 | def resolve_core_mask(core_mask): |
| 47 | def resolve(text): |
| 48 | if text == "%p": |
| 49 | return str(pid) |
| 50 | elif text == "%e": |
| 51 | # https://github.com/torvalds/linux/blob/7876320f88802b22d4e2daf7eb027dd14175a0f8/include/linux/sched.h#L847 |
| 52 | # https://github.com/torvalds/linux/blob/7876320f88802b22d4e2daf7eb027dd14175a0f8/fs/coredump.c#L278 |
| 53 | return os.path.basename(binary_path)[:15] |
| 54 | elif text == "%E": |
| 55 | return binary_path.replace("/", "!") |
| 56 | elif text == "%%": |
| 57 | return "%" |
| 58 | elif text.startswith("%"): |
| 59 | return "*" |
| 60 | return text |
| 61 | |
| 62 | parts = filter(None, re.split(r"(%.)", core_mask)) |
| 63 | return "".join([resolve(p) for p in parts]) |
| 64 | |
| 65 | # don't interpret a program for piping core dumps as a pattern |
| 66 | if core_pattern and not core_pattern.startswith("|"): |
no test coverage detected