fix(sync-ui): exit CLI cleanly when sync window closes

- Use runAppCommandInteractive so sync-window inherits the terminal directly
- Quit app on window-all-closed when launched with --sync-window on macOS
- Catch synchronous onWillQuitCleanup errors to prevent quit getting stuck
This commit is contained in:
2026-07-12 16:39:13 -07:00
parent a013a7ea55
commit a4c12165af
5 changed files with 73 additions and 4 deletions
+4 -1
View File
@@ -1,12 +1,14 @@
import {
launchAppBackgroundDetached,
launchTexthookerOnly,
runAppCommandInteractive,
runAppCommandWithInherit,
} from '../mpv.js';
import type { LauncherCommandContext } from './context.js';
type AppCommandDeps = {
runAppCommandWithInherit: (appPath: string, appArgs: string[]) => void;
runAppCommandInteractive: (appPath: string, appArgs: string[]) => void;
launchAppBackgroundDetached: (
appPath: string,
logLevel: LauncherCommandContext['args']['logLevel'],
@@ -15,6 +17,7 @@ type AppCommandDeps = {
const defaultAppCommandDeps: AppCommandDeps = {
runAppCommandWithInherit,
runAppCommandInteractive,
launchAppBackgroundDetached,
};
@@ -31,7 +34,7 @@ export function runAppPassthroughCommand(
return true;
}
if (args.syncUi) {
deps.runAppCommandWithInherit(appPath, ['--sync-window']);
deps.runAppCommandInteractive(appPath, ['--sync-window']);
return true;
}
if (!args.appPassthrough) {