fix(cli): require cancellation through command finalization
Adapt the forwarding proposal in #4652 with a required signal before optional resource diagnostics. Migrate all callers and cover actual command registration during final close. Refs #4939. Co-authored-by: Tapraj-Pathak <[email protected]>
This commit is contained in:
1 parent
2ae4e1608f
commit
279c590ef6
30 files changed
+154
-20
No files matched your search
@@ -29,6 +29,7 @@ export const registerAdbCommands = (
|
||||
{ close: () => provider.close() },
|
||||
"adb",
|
||||
operation,
|
||||
signal,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -25,6 +25,7 @@ export const registerAndroidCommands = (
|
||||
{ close: () => provider.close() },
|
||||
"jadx",
|
||||
operation,
|
||||
signal,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -31,6 +31,7 @@ export const registerApktoolCommands = (
|
||||
{ close: () => provider.close() },
|
||||
"apktool",
|
||||
operation,
|
||||
signal,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -48,6 +48,7 @@ export const registerBinaryDiagnosticsCommands = (
|
||||
pe,
|
||||
"rea-pe-resources",
|
||||
"inspect_pe_resources",
|
||||
signal,
|
||||
),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -88,7 +88,6 @@ const registerWebMcp = (
|
||||
},
|
||||
context.provider.identity().id,
|
||||
"discover_webmcp_tools",
|
||||
undefined,
|
||||
signal,
|
||||
);
|
||||
}),
|
||||
@@ -200,7 +199,6 @@ const registerScreenshot = (
|
||||
},
|
||||
context.provider.identity().id,
|
||||
"capture_web_screenshot",
|
||||
undefined,
|
||||
signal,
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -75,7 +75,6 @@ const registerTargetList = (
|
||||
},
|
||||
context.provider.identity().id,
|
||||
"list_browser_targets",
|
||||
undefined,
|
||||
signal,
|
||||
);
|
||||
}),
|
||||
@@ -132,7 +131,6 @@ const registerPageInspection = (
|
||||
},
|
||||
context.provider.identity().id,
|
||||
"inspect_web_page",
|
||||
undefined,
|
||||
signal,
|
||||
);
|
||||
}),
|
||||
@@ -191,7 +189,6 @@ const registerBundleAnalysis = (
|
||||
},
|
||||
context.provider.identity().id,
|
||||
"analyze_web_bundle",
|
||||
undefined,
|
||||
signal,
|
||||
);
|
||||
}),
|
||||
@@ -243,7 +240,6 @@ const registerObservationSession = (
|
||||
},
|
||||
context.provider.identity().id,
|
||||
"observe_web_session",
|
||||
undefined,
|
||||
signal,
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -60,6 +60,7 @@ export const registerCaptureCommands = (
|
||||
service,
|
||||
"tshark-capture",
|
||||
"inspect_packet_fields",
|
||||
signal,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -112,6 +113,7 @@ export const registerCaptureCommands = (
|
||||
service,
|
||||
"tshark-capture",
|
||||
"inspect_packet_capture",
|
||||
signal,
|
||||
);
|
||||
}),
|
||||
),
|
||||
|
||||
@@ -123,7 +123,6 @@ export const registerCutterCommands = (
|
||||
cutter,
|
||||
"cutter",
|
||||
"cutter_command",
|
||||
undefined,
|
||||
signal,
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -64,7 +64,6 @@ const registerElectronFuseCommand = (
|
||||
service,
|
||||
service.provider.identity.id,
|
||||
"inspect_electron_fuses",
|
||||
undefined,
|
||||
signal,
|
||||
);
|
||||
}),
|
||||
@@ -134,7 +133,6 @@ const registerElectronActiveCommand = (
|
||||
},
|
||||
provider.identity().id,
|
||||
"capture_electron_scenario",
|
||||
undefined,
|
||||
signal,
|
||||
);
|
||||
return "code" in result
|
||||
@@ -217,7 +215,6 @@ const registerElectronTargetList = (
|
||||
},
|
||||
"rea-cdp-electron",
|
||||
"list_electron_targets",
|
||||
undefined,
|
||||
signal,
|
||||
);
|
||||
}),
|
||||
@@ -259,7 +256,6 @@ const registerElectronPageInspection = (
|
||||
},
|
||||
"rea-cdp-electron",
|
||||
"inspect_electron_page",
|
||||
undefined,
|
||||
signal,
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -37,6 +37,7 @@ export const registerEvmCommands = (
|
||||
service,
|
||||
"evmole-interface",
|
||||
"inspect_evm_interface",
|
||||
signal,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -18,8 +18,8 @@ export const finishAnalysisCommand = async <
|
||||
service: { close(): Promise<void> },
|
||||
providerId: string,
|
||||
canonicalOperation: string,
|
||||
signal: AbortSignal,
|
||||
fallbackResource?: string,
|
||||
signal?: AbortSignal,
|
||||
): Promise<Value | ReturnType<typeof projectAnalysisError>> => {
|
||||
let result: Result<Value, AnalysisError>;
|
||||
try {
|
||||
@@ -69,7 +69,7 @@ export const finishAnalysisCommand = async <
|
||||
),
|
||||
);
|
||||
}
|
||||
if (result.ok && signal?.aborted === true)
|
||||
if (result.ok && signal.aborted)
|
||||
return projectAnalysisError(
|
||||
new AnalysisCancelledError(canonicalOperation, {
|
||||
cause: signal.reason,
|
||||
|
||||
@@ -35,7 +35,6 @@ export const registerFirmwareCommands = (
|
||||
service,
|
||||
operation === "inspect_firmware_regions" ? "binwalk" : "unblob",
|
||||
operation,
|
||||
undefined,
|
||||
signal,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -84,7 +84,6 @@ export const registerFlutterCommands = (
|
||||
{ close: () => provider.close() },
|
||||
"flutter",
|
||||
spec.operation,
|
||||
undefined,
|
||||
signal,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -32,6 +32,7 @@ export const registerGoCommands = (cli: CliInstance, logger: Logger): void => {
|
||||
service,
|
||||
"go-build-info",
|
||||
"inspect_go_binary",
|
||||
signal,
|
||||
),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -70,6 +70,7 @@ export const registerJavaScriptRecoveryCommands = (
|
||||
service,
|
||||
"wakaru",
|
||||
"recover_javascript_sources",
|
||||
signal,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -26,6 +26,7 @@ export const registerJebCommands = (
|
||||
{ close: () => provider.close() },
|
||||
"jeb",
|
||||
operation,
|
||||
signal,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -26,6 +26,7 @@ export const registerPcapCommands = (
|
||||
{ close: () => provider.close() },
|
||||
"pcap",
|
||||
operation,
|
||||
signal,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -32,7 +32,6 @@ export const registerRustCommands = (
|
||||
service,
|
||||
"rust-auditable",
|
||||
"inspect_rust_binary",
|
||||
undefined,
|
||||
signal,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -62,6 +62,7 @@ export const registerSignalCommands = (
|
||||
service,
|
||||
"sigrok-recording",
|
||||
"inspect_signal_decoders",
|
||||
signal,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -114,6 +115,7 @@ export const registerSignalCommands = (
|
||||
service,
|
||||
"sigrok-recording",
|
||||
"decode_signal_recording",
|
||||
signal,
|
||||
);
|
||||
}),
|
||||
),
|
||||
|
||||
@@ -73,6 +73,7 @@ export const registerSqliteCommands = (
|
||||
service,
|
||||
"sqlite",
|
||||
"inspect_sqlite_database",
|
||||
signal,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -76,6 +76,7 @@ export const registerWasmCommands = (
|
||||
service,
|
||||
"wabt-artifact",
|
||||
"inspect_wasm_artifact",
|
||||
signal,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -66,6 +66,7 @@ export const registerWebModuleCommands = (
|
||||
service,
|
||||
"web-module-trace",
|
||||
"trace_web_module_imports",
|
||||
signal,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -59,6 +59,7 @@ export const registerWebNetworkCaptureCommands = (
|
||||
service,
|
||||
"web-network-capture",
|
||||
"inspect_web_network_capture",
|
||||
signal,
|
||||
"Web network capture resources",
|
||||
);
|
||||
},
|
||||
|
||||
@@ -59,7 +59,6 @@ export const registerWebRuntimeCommands = (
|
||||
},
|
||||
service.provider.identity().id,
|
||||
"observe_web_execution",
|
||||
undefined,
|
||||
signal,
|
||||
);
|
||||
}),
|
||||
@@ -100,7 +99,6 @@ export const registerWebRuntimeCommands = (
|
||||
},
|
||||
service.provider.identity().id,
|
||||
"inspect_web_event_listeners",
|
||||
undefined,
|
||||
signal,
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -54,6 +54,7 @@ export const registerWebSourceLocationCommands = (
|
||||
service,
|
||||
"web-source-location",
|
||||
"trace_web_source_location",
|
||||
signal,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user