Files
mtusi2026lab7/scripts/diagnose.ts
T
rey eb1b5c7b84
Skeleton contracts / contracts (pull_request) Canceled after 0s
Prepare verified laboratory 7 implementation and evidence
2026-11-17 17:32:06 +03:00

44 lines
1.1 KiB
TypeScript

import { compose, run, local, privateWrite } from "./runtime";
import { resolve } from "node:path";
const categories = [
"Permission denied",
"Operation not permitted",
"Unknown command or category name",
"Failed trying to load the ACL",
"Syntax error",
"FATAL",
"No such file or directory",
"cannot change permissions",
"invalid value",
"not a valid",
"unknown flag",
"unrecognized configuration parameter",
"could not load",
"could not access",
"out of memory",
"Address already in use",
"cannot open",
"server key file has group or world access",
"server key file must be owned",
"invalid connection type",
];
for (const service of Bun.argv.slice(2)) {
const logs = await compose(["logs", "--no-color", "--tail", "80", service], {
allowFailure: true,
});
await privateWrite(
resolve(local, "diagnostics", service + "-logs.txt"),
logs.out + logs.err,
);
const content = logs.out + logs.err;
console.log(
JSON.stringify({
service,
exit: logs.code,
categories: categories.filter((x) =>
content.toLowerCase().includes(x.toLowerCase()),
),
}),
);
}