@hivey/cli 0.9.58 → 0.9.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
Binary file
|
package/package.json
CHANGED
|
@@ -102,6 +102,11 @@ def log_path(command: str) -> str | None:
|
|
|
102
102
|
return os.path.expanduser(m.group(1)) if m else None
|
|
103
103
|
|
|
104
104
|
|
|
105
|
+
def _is_err(line: str) -> bool:
|
|
106
|
+
return bool(re.search(r"error|traceback|exception|failed|fatal", line, re.I)
|
|
107
|
+
and not re.search(r"\b0 failed|failed:? 0\b|0 errors?\b|errors?:? 0\b|rerun picks", line, re.I))
|
|
108
|
+
|
|
109
|
+
|
|
105
110
|
def log_info(path: str | None) -> dict:
|
|
106
111
|
if not path or not os.path.isfile(path):
|
|
107
112
|
return {}
|
|
@@ -112,9 +117,11 @@ def log_info(path: str | None) -> dict:
|
|
|
112
117
|
f.seek(max(0, st.st_size - 6000))
|
|
113
118
|
tail = f.read().decode("utf-8", "replace").splitlines()[-40:]
|
|
114
119
|
tail = [re.sub(r"\x1b\[[0-9;]*[A-Za-z]|\r", "", l)[:300] for l in tail]
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
# logs are appended run after run: an error from an earlier run that a later run's success line
|
|
121
|
+
# follows is history, not a current problem (a Baserow timeout stayed flagged after good runs)
|
|
122
|
+
ok = re.compile(r"\b(success(ful(ly)?)?|succeeded|finished|completed?|done|wrote|all ok)\b", re.I)
|
|
123
|
+
last_ok = max((i for i, l in enumerate(tail) if ok.search(l) and not _is_err(l)), default=-1)
|
|
124
|
+
errs = [l.strip() for l in tail[last_ok + 1:] if _is_err(l)]
|
|
118
125
|
if errs:
|
|
119
126
|
info["last_error"] = errs[-1][:200]
|
|
120
127
|
info["errors"] = list(dict.fromkeys(e[:200] for e in errs))[-5:]
|