mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-10 22:20:14 +00:00
fix(cli): keep post-render exit reset root-owned
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
* still exited 1 after the terminal "artifact validated" checkpoint.
|
||||
*/
|
||||
|
||||
import { sanitizeSuccessfulExitCode } from "./commandResult.js";
|
||||
|
||||
let renderSucceeded = false;
|
||||
|
||||
/**
|
||||
@@ -57,8 +59,8 @@ const defaultErrorSink: PostRenderErrorSink = (message) => {
|
||||
* Run a post-artifact-validated cleanup step so a throw cannot flip the CLI
|
||||
* exit code. `markRenderSucceeded()` MUST have been called first — this
|
||||
* helper is only safe on the success path where the artifact is already
|
||||
* committed to disk. Logs a compact warning to stderr, resets a stray
|
||||
* `process.exitCode` back to 0, and swallows the error.
|
||||
* committed to disk. Logs a compact warning to stderr, asks the root CLI to
|
||||
* clear a stray exit code, and swallows the error.
|
||||
*/
|
||||
export function runPostRenderStep(
|
||||
label: string,
|
||||
@@ -87,9 +89,7 @@ export async function runPostRenderStepAsync(
|
||||
function reportPostRenderStepFailure(label: string, err: unknown, sink: PostRenderErrorSink): void {
|
||||
const message = err instanceof Error ? err.message : String(err);
|
||||
sink(` [hyperframes] Post-render step '${label}' failed (render already succeeded): ${message}`);
|
||||
// Guard against the failing step (or something it triggered) setting a
|
||||
// non-zero exitCode. The render succeeded → the CLI must exit 0.
|
||||
if (process.exitCode !== undefined && process.exitCode !== 0) {
|
||||
process.exitCode = 0;
|
||||
}
|
||||
// The failing step (or something it triggered) may have set a non-zero
|
||||
// exitCode. The render succeeded, so ask the root CLI owner to clear it.
|
||||
sanitizeSuccessfulExitCode();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user