@nice-code/commander 0.106.0 → 0.107.0

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.
package/build/cli.mjs CHANGED
@@ -3,7 +3,7 @@ import { t as COMMANDER_ID_PATTERN } from "./types-B3WIUo4S.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { mkdir, open, readFile, realpath, rename, unlink, writeFile } from "node:fs/promises";
5
5
  import { basename, dirname, isAbsolute, join, resolve } from "node:path";
6
- import { createNiceProcess, detectCapability, openProcessLedger, readProcessStartStamp, signalProcessGroup, taskkillTree } from "@nice-code/process";
6
+ import { createNiceProcess, detectCapability, matchProcessStartStamp, openProcessLedger, readProcessStartStamp, signalProcessGroup, taskkillTree } from "@nice-code/process";
7
7
  import { closeSync, existsSync, openSync, readFileSync, realpathSync, statSync } from "node:fs";
8
8
  import { pathToFileURL } from "node:url";
9
9
  import { createJiti } from "jiti";
@@ -235,8 +235,7 @@ async function recordDaemonAlive(record) {
235
235
  if (error.code !== "EPERM") return false;
236
236
  }
237
237
  if (record.startStamp == null) return true;
238
- const stamp = await readProcessStartStamp(record.pid);
239
- return stamp != null && stamp.stamp === record.startStamp.stamp;
238
+ return await matchProcessStartStamp(record.pid, record.startStamp.stamp) === "match";
240
239
  }
241
240
  /**
242
241
  * Protocol-independent shutdown: verify the record's pid is still the daemon it claims to be
@@ -259,8 +258,7 @@ async function signalDaemonShutdown(target, waitMs = 15e3) {
259
258
  outcome: "identity-unverified",
260
259
  pid
261
260
  };
262
- const stamp = await readProcessStartStamp(pid);
263
- if (stamp == null || stamp.stamp !== startStamp.stamp) return {
261
+ if (await matchProcessStartStamp(pid, startStamp.stamp) !== "match") return {
264
262
  outcome: "identity-unverified",
265
263
  pid
266
264
  };
@@ -26009,8 +26007,7 @@ async function diagnose(ctx, handle) {
26009
26007
  continue;
26010
26008
  }
26011
26009
  if (record.startStamp != null) {
26012
- const stamp = await readProcessStartStamp(record.pid);
26013
- if (stamp == null || stamp.stamp !== record.startStamp) {
26010
+ if (await matchProcessStartStamp(record.pid, record.startStamp) !== "match") {
26014
26011
  report.warnings.push(`ledger "${record.id}": pid ${record.pid} fails the fingerprint check (reuse?) — quarantine-suspect`);
26015
26012
  continue;
26016
26013
  }