5b6e8db2d7
Applied the console-aware launch policy in the original OMP process before spawning the broker. The broker now inherits the caller's console state instead of probing a detached console it created itself.
18 lines
537 B
TypeScript
18 lines
537 B
TypeScript
/** Platform-specific options for the launch broker and its non-PTY children. */
|
|
export interface DaemonSpawnOptions {
|
|
detached: boolean;
|
|
windowsHide?: boolean;
|
|
}
|
|
|
|
/** Keep launch processes headless without discarding an inheritable Windows console. */
|
|
export function resolveDaemonSpawnOptions(opts: {
|
|
platform: NodeJS.Platform;
|
|
hostHasInheritableConsole: boolean;
|
|
}): DaemonSpawnOptions {
|
|
if (opts.platform !== "win32") return { detached: true };
|
|
return {
|
|
detached: false,
|
|
windowsHide: !opts.hostHasInheritableConsole,
|
|
};
|
|
}
|