Skip to main content

Module instance

Module instance 

Source
Expand description

Single-instance arbitration over rightkit-daemon (no extra plugin, no lock file).

The first process hosts the <service-id>-shell service (see service_name for how an app id becomes <service-id>) on the suite’s current-user-only socket / named pipe. A later process finds a live record, forwards its argv and working directory with second-instance, and exits. Because liveness is a probed endpoint plus a live pid, a crashed primary never blocks the next launch (a stale record is discarded).

Donors: all three apps used tauri-plugin-single-instance; this keeps its contract (callback with argv + cwd) and adds suite isolation for tests.

Structs§

InvalidAppId
An app id that cannot be turned into a valid rightkit-daemon name.
SecondInstance

Enums§

Arbitration
InvalidAppIdReason
Why an app id cannot name a single-instance service.

Constants§

METHOD

Functions§

arbitrate
Arbitrate single-instance for app_id.
arbitrate_with_legacy
Arbitration that also probes for a live tauri-plugin-single-instance holder under legacy_identifier (the Tauri identifier) first. A live legacy holder receives this launch and the result is Arbitration::Secondary; an unreachable one is Arbitration::Unavailable. A socket that only a leaked descriptor keeps open is not a live holder, and a macOS holder that stays silent is logged on stderr as unconfirmed (see ClaimOutcome::Forwarded).
service_name
try_service_name without the check: the normalised name even when it is empty or too long, which arbitrate would refuse. Prefer try_service_name.
try_service_name
The service name arbitration hosts for app_id: the normalised id plus -shell, so an id that is already [a-z0-9-] gives exactly <id>-shell (running instances keep being found across upgrades) and "app.mailright" gives "app-mailright-shell". rightkit-daemon allows only 1 to 48 bytes of [a-z0-9-], so an empty id or one longer than 42 bytes is refused.