mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-21 00:03:52 +00:00
A run target can be a Docker image or a Compose service: the configuration runs as a local docker run --rm / docker compose run --rm with the project bind-mounted, so the console, PTY, stdin, Stop and test parsers work unchanged. Only daemons on this machine are accepted; on Linux the container runs as the project folder's owner; Stop runs docker stop with the same docker CLI. Debugging, coverage and profiling stay on this machine. Refs #1083 (step A1). Co-authored-by: andreabasile <7715018+andreabasile@users.noreply.github.com>
35 lines
1.2 KiB
TypeScript
35 lines
1.2 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),
|
|
});
|
|
return;
|
|
}
|
|
if (!plan) return;
|
|
const { launch, finished } = plan;
|
|
await startRun(config, undefined, undefined, {
|
|
launch,
|
|
onExit: (exitCode, stopped) => finished({ exitCode, stopped }),
|
|
});
|
|
}
|