Files
hyperframes/packages/cli/src/utils/artifactCapture.ts
T
Miguel Ángel 01adadb918 fix(cli): check and snapshot keep their record while another app has the history open (#5845)
* fix(cli): check and snapshot keep their record while another app has the history open

* test(cli): a held history no longer drops the snapshot record
2026-10-18 15:14:48 +00:00

16 lines
563 B
TypeScript

import { HistoryBusyError, beginArtifactCapture } from "@hyperframes/studio-server/history";
import { withOwner } from "./historyOwner.js";
const SKIP_BUSY_HISTORY = { ownerWaitMs: 0 };
function unlessAnotherProcessKeepsTheHistory(error: unknown): void {
if (!(error instanceof HistoryBusyError)) throw error;
}
export async function captureArtifactRevision(projectDir: string) {
await withOwner(projectDir, (owner) => owner.checkpoint(), SKIP_BUSY_HISTORY).catch(
unlessAnotherProcessKeepsTheHistory,
);
return beginArtifactCapture(projectDir);
}