fix(javascript): honor cancellation before evidence publication (#1098)
This commit is contained in:
1 parent
f8e143a3bc
commit
cc0ee2edc6
18 files changed
+1080
-74
No files matched your search
@@ -8,6 +8,7 @@ import type { CliCommandOutput } from "./streamedJsonOutput.js";
|
||||
export const runCliJavaScriptApplicationAnalysis = async (
|
||||
input: unknown,
|
||||
output?: CliCommandOutput,
|
||||
signal?: AbortSignal,
|
||||
): Promise<JsonValue | undefined> => {
|
||||
const started = performance.now();
|
||||
const progress = createProgressReporter(
|
||||
@@ -16,7 +17,10 @@ export const runCliJavaScriptApplicationAnalysis = async (
|
||||
},
|
||||
{ minimumIntervalMs: 0 },
|
||||
);
|
||||
const result = await analyzeJavaScriptApplication(input, { progress });
|
||||
const result = await analyzeJavaScriptApplication(input, {
|
||||
progress,
|
||||
...(signal === undefined ? {} : { signal }),
|
||||
});
|
||||
const value = result.ok ? result.value : cliError(result.error);
|
||||
if (
|
||||
output !== undefined &&
|
||||
@@ -26,7 +30,8 @@ export const runCliJavaScriptApplicationAnalysis = async (
|
||||
duration: `${Math.round(performance.now() - started)}ms`,
|
||||
}))
|
||||
)
|
||||
return undefined;
|
||||
// Keep failures visible to command logging after the stream has handled stdout.
|
||||
return result.ok ? undefined : value;
|
||||
return value;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user