Files
SubMiner/src/main/startup-lifecycle.ts
T
sudacode a013a7ea55 feat(sync-ui): defer app quit until async cleanup resolves
- check-host participates in active-run coordination and can be cancelled
- shutdown() cancels and awaits the active launcher run on quit
- onWillQuit calls preventDefault and re-triggers quit once cleanup settles
- Snapshot mode awaits tracker quiescent before writing output
- Auto-scheduler catches synchronous triggerHostSync failures
- SCP endpoint accepts Windows absolute paths; cmd.exe rejects % in quoted values
- runAppCommand unified (inherit vs pipe stdio) in launcher/mpv.ts
- Docs: add --check, --json, --ui, --sync-cli, --make-temp/--remove-temp examples
2026-07-12 03:35:39 -07:00

49 lines
1.9 KiB
TypeScript

import { CliArgs, CliCommandSource } from '../cli/args';
import { createAppLifecycleDepsRuntime } from '../core/services';
import { startAppLifecycle } from '../core/services/app-lifecycle';
import type { AppLifecycleDepsRuntimeOptions } from '../core/services/app-lifecycle';
import { createAppLifecycleRuntimeDeps } from './app-lifecycle';
export interface AppLifecycleRuntimeRunnerParams {
app: AppLifecycleDepsRuntimeOptions['app'];
platform: NodeJS.Platform;
shouldStartApp: (args: CliArgs) => boolean;
parseArgs: (argv: string[]) => CliArgs;
handleCliCommand: (nextArgs: CliArgs, source: CliCommandSource) => void;
printHelp: () => void;
logNoRunningInstance: () => void;
startControlServer?: (handleArgv: (argv: string[]) => void) => (() => void) | void;
onReady: () => Promise<void>;
onWillQuitCleanup: () => void | Promise<void>;
shouldRestoreWindowsOnActivate: () => boolean;
restoreWindowsOnActivate: () => void;
shouldQuitOnWindowAllClosed: () => boolean;
}
export function createAppLifecycleRuntimeRunner(
params: AppLifecycleRuntimeRunnerParams,
): (args: CliArgs) => void {
return (args: CliArgs): void => {
startAppLifecycle(
args,
createAppLifecycleDepsRuntime(
createAppLifecycleRuntimeDeps({
app: params.app,
platform: params.platform,
shouldStartApp: params.shouldStartApp,
parseArgs: params.parseArgs,
handleCliCommand: params.handleCliCommand,
printHelp: params.printHelp,
logNoRunningInstance: params.logNoRunningInstance,
startControlServer: params.startControlServer,
onReady: params.onReady,
onWillQuitCleanup: params.onWillQuitCleanup,
shouldRestoreWindowsOnActivate: params.shouldRestoreWindowsOnActivate,
restoreWindowsOnActivate: params.restoreWindowsOnActivate,
shouldQuitOnWindowAllClosed: params.shouldQuitOnWindowAllClosed,
}),
),
);
};
}