Файли
openidea/src/features/run/executors.ts
T
l0ng-ai ccfa4a1f22 fix(run): show why Profile or Run with Coverage did not start (#5025)
With the Run notification group set to not show balloons (Settings › Notifications, or Don't Show Again on a Run notification), clicking Profile '…' / Allocations / Live Objects or Run with Coverage looked like it did nothing: the reason the run could not start (async-profiler or the coverage tool is not installed, the configuration is not supported, preparing it failed) went only to the Notifications list. These notifications answer a command the user just ran, so they are now `userInitiated` and always show as a balloon, like a manual update check.
2026-11-22 00:51:58 +08:00

37 рядки
1.3 KiB
TypeScript

/**
* Run executors contributed by other features (Run with Coverage, Profile):
* the executor plans what to launch, the run shows in the Run tool window like
* any other, and the executor hears when the process exits.
*/
import type { RunConfig } from "@/platform/ipc";
import { notifications, useRunExecutors, type ExecutorLaunch } from "@/workbench/contributions";
import { containerExecutorBlocked } from "./remote";
import { prepareLaunch, startRun } from "./store";
export async function runWithExecutor(config: RunConfig, executorId: string): Promise<void> {
const executor = useRunExecutors.getState().executors.get(executorId);
if (!executor) return;
if (containerExecutorBlocked(config)) return;
if (!(await prepareLaunch(config))) return;
let plan: ExecutorLaunch | null;
try {
plan = await executor.prepare(config);
} catch (e) {
notifications().notify({
group: "run",
level: "error",
title: `Cannot run '${config.name}'`,
body: e instanceof Error ? e.message : String(e),
userInitiated: true,
});
return;
}
if (!plan) return;
const { launch, finished, beforeStop } = plan;
await startRun(config, undefined, undefined, {
launch,
onExit: (exitCode, stopped) => finished({ exitCode, stopped }),
beforeStop,
});
}