Files
reverse-engineering-anything/src/apktool/ApktoolCommandOutput.ts
T
morluto 0d35ea065d refactor(process): build provider captured output through one owner (#11330)
* refactor(process): build provider captured output through one owner

* fix(process): report only declared diagnostics on successful provider results
2026-11-16 03:46:35 +08:00

22 lines
983 B
TypeScript

import { capturedProviderOutput } from "../process/capturedProviderOutput.js";
import { OwnedCommandFailure } from "../process/OwnedCommand.js";
import { DarwinProcessOwnershipInspectionError } from "../process/DarwinProcessRunTokenReader.js";
import type { AnalysisCapturedOutput } from "../domain/analysisErrorBase.js";
import type { ProviderProcessSnapshot } from "../process/ProviderProcess.js";
/** The command owner selects command output or preparation output, once. */
export const capturedApktoolFailureOutput = (
cause: unknown,
): AnalysisCapturedOutput | undefined => {
if (cause instanceof OwnedCommandFailure)
return cause.snapshot === null
? cause.preparationFailure instanceof
DarwinProcessOwnershipInspectionError
? cause.preparationFailure.capturedOutput
: undefined
: capturedProviderOutput(cause.snapshot);
return cause instanceof DarwinProcessOwnershipInspectionError
? cause.capturedOutput
: undefined;
};