Skip to content

✨ Restrict running sessions to one concurrent one#258

Open
a-kenji wants to merge 2 commits intomainfrom
ke-lock-unique
Open

✨ Restrict running sessions to one concurrent one#258
a-kenji wants to merge 2 commits intomainfrom
ke-lock-unique

Conversation

@a-kenji
Copy link
Collaborator

@a-kenji a-kenji commented Feb 5, 2026

Restrict running sessions to one concurrent one.
Uses the XDG_RUNTIME_DIR to hold an exclusive runtime lock.
The lock is automatically cleaned up upon exit.
Falls back gracefully, if the variable is not set.

An earlier implementation used the fs4 crate, but
now this functionality is in the stdlib since rustc --version: 1.89.0.

Closes: #179
Supercedes: #182

Restrict running sessions to one concurrent one.
Uses the `XDG_RUNTIME_DIR` to hold an exclusive runtime lock.
The lock is automatically cleaned up upon exit.

An earlier implementation used the `fs4` crate, but
now this functionality is in the `stdlib` since `rustc --version`: `1.89.0`.

Closes: #179
Supercedes: #182
Alternatively we could also add a drop `impl`, and call `eguis` native exit
handling.
a-kenji added a commit that referenced this pull request Feb 15, 2026
Restrict running sessions to one concurrent one.
Uses the `XDG_RUNTIME_DIR` to hold an exclusive runtime lock.

As opposed to #258, we don't block starting a new session on the lock,
but clean up the old session and start a new session.

The end result is similar: There will only be one `centerpiece` session
open at the same time.

Alternatives:
- Use #258 for the other behavior
- Link directly to the C functions for kill, but we depend on `libc`
  transitively anyway already
- shell out to the `kill` command, this would mean we depend on the
  external `kill` command for this functionality
a-kenji added a commit that referenced this pull request Feb 15, 2026
Restrict running sessions to one concurrent one.
Uses the `XDG_RUNTIME_DIR` to hold an exclusive runtime lock.

As opposed to #258, we don't block starting a new session on the lock,
but clean up the old session and start a new session.

The end result is similar: There will only be one `centerpiece` session
open at the same time.

Alternatives:
- Use #258 for the other behavior
- Link directly to the C functions for kill, but we depend on `libc`
  transitively anyway already
- shell out to the `kill` command, this would mean we depend on the
  external `kill` command for this functionality
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Centerpiece should run as a singleton

2 participants