Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Engine records: compare a macOS start time by its words, so a one-digit day's padded space still matches

milind-soni81c25e30c8e6
diff --git a/server/engine-records.ts b/server/engine-records.ts
index 3899da2020..a0778e864f 100644
--- a/server/engine-records.ts
+++ b/server/engine-records.ts
@@ -104,7 +104,8 @@ function exists(pid: number): boolean {
/** One process from two readings: the start tick (Linux) or lstart string, or on macOS within 2 s of when spawn returned. */
function sameStart(leader: Leader, listed: string): boolean {
- if (leader.start) return leader.start === listed;
+ // ps pads a one-digit day with a second space ("Dec 1"); the listing's split drops it, so compare words, not spacing.
+ if (leader.start) return leader.start.split(/\s+/).join(" ") === listed.split(/\s+/).join(" ");
if (leader.at === null) return false;
const seen = Date.parse(listed);
return Number.isFinite(seen) && Math.abs(seen - leader.at) < 2_000;