fix: daemon status guidance and telegram fetch

This commit is contained in:
Peter Steinberger
2026-01-08 08:39:55 +01:00
parent 5b397c0f15
commit 9a11325cc9
5 changed files with 47 additions and 22 deletions

View File

@@ -19,14 +19,18 @@ function formatSpawnDetail(result: {
}): string {
const clean = (value: string | Buffer | null | undefined) => {
const text =
typeof value === "string"
? value
: value
? value.toString()
: "";
typeof value === "string" ? value : value ? value.toString() : "";
return text.replace(/\s+/g, " ").trim();
};
if (result.error) return String(result.error);
if (result.error) {
if (result.error instanceof Error) return result.error.message;
if (typeof result.error === "string") return result.error;
try {
return JSON.stringify(result.error);
} catch {
return "unknown error";
}
}
const stderr = clean(result.stderr);
if (stderr) return stderr;
const stdout = clean(result.stdout);
@@ -42,6 +46,9 @@ function normalizeSystemdUnit(raw?: string): string {
}
export function triggerClawdbotRestart(): RestartAttempt {
if (process.env.VITEST || process.env.NODE_ENV === "test") {
return { ok: true, method: "supervisor", detail: "test mode" };
}
const tried: string[] = [];
if (process.platform !== "darwin") {
if (process.platform === "linux") {