mirror of
https://github.com/morluto/rea.git
synced 2026-11-14 18:52:48 +00:00
fix(browser): preserve physical failures through later cancellation (#10046)
* fix(browser): retain physical failures through late cancellation * fix(browser): preserve process inspection cancellation and ownership * fix(process): preserve independently aborted inspection failures
This commit is contained in:
1 parent
a16f5f4b5d
commit
4a3bc37b76
13 files changed
+853
-137
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { isProcessOwnershipInspectionCancellation } from "./ProcessInspectionCancellation.js";
|
||||
import { ProcessAdmissionError } from "./ProcessAdmissionError.js";
|
||||
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
||||
import { rmSync } from "node:fs";
|
||||
@@ -360,11 +361,6 @@ const abortReason = (signal: AbortSignal): unknown => {
|
||||
return error;
|
||||
};
|
||||
|
||||
const isExpectedAbort = (cause: unknown, signal: AbortSignal): boolean =>
|
||||
signal.aborted &&
|
||||
(cause === signal.reason ||
|
||||
(cause instanceof Error && cause.name === "AbortError"));
|
||||
|
||||
type CompilationWaitOutcome =
|
||||
| { readonly kind: "completed"; readonly result: Result<string, unknown> }
|
||||
| { readonly kind: "cancelled"; readonly reason: unknown };
|
||||
@@ -573,7 +569,8 @@ export const createDarwinProcessRunTokenReader = (
|
||||
env: compilerEnvironment,
|
||||
});
|
||||
} catch (cause: unknown) {
|
||||
if (isExpectedAbort(cause, signal)) throw cause;
|
||||
if (isProcessOwnershipInspectionCancellation(cause, signal))
|
||||
throw cause;
|
||||
throw compilerInspectionError(cause, compilerTimeoutMs, compiler);
|
||||
}
|
||||
if (signal.aborted || closed) throw abortReason(signal);
|
||||
@@ -652,7 +649,7 @@ export const createDarwinProcessRunTokenReader = (
|
||||
if (
|
||||
(failure instanceof DarwinProcessOwnershipInspectionError &&
|
||||
failure.cleanupFailure !== undefined) ||
|
||||
!isExpectedAbort(
|
||||
!isProcessOwnershipInspectionCancellation(
|
||||
operation.primaryFailure?.cause,
|
||||
operation.controller.signal,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user