Files
Toju/electron/app/second-instance.rules.ts
T
myxelium e49b3ec112 chore: dev-stack switches, shared e2e harness, and desktop shell rules
- `LIVE_RELOAD=false npm run dev` keeps the renderer alive across a machine
  suspend; the reload client otherwise destroys the session under test.
- `dev-peer.sh` plus a separate userdata dir runs a second local peer.
- `tools/voice-probe.js` samples peer state and RTP counters from a live
  window, persisting to localStorage so a renderer reload cannot erase it.
- e2e helpers for voice pairs, peer-role election, and a TURN relay.
- Electron single-instance and dev-client-load decisions move into rules
  files with colocated specs.
2026-08-14 03:19:29 +02:00

24 lines
902 B
TypeScript

export const DEV_RELOAD_EXISTING_ARG = '--metoyou-dev-reload-existing';
export type SecondInstanceAction = 'reload-existing' | 'focus';
export interface SecondInstanceInput {
argv: string[];
devSingleInstanceExitCode: number | null;
}
/**
* A dev launch always carries `--metoyou-dev-reload-existing`, so the running
* instance reloads in place. It must never answer by relaunching itself: the
* successor inherits the same argument and asks for the single-instance lock
* while the dying parent still holds it, so the refused successor fires
* `second-instance` again and the pair respawns forever.
*/
export function resolveSecondInstanceAction(input: SecondInstanceInput): SecondInstanceAction {
const isDevelopmentLaunch = input.devSingleInstanceExitCode != null;
return isDevelopmentLaunch && input.argv.includes(DEV_RELOAD_EXISTING_ARG)
? 'reload-existing'
: 'focus';
}