[PR #3713] [MERGED] Launcher: a command after the game exits, and the instance's variables #5164

Closed
opened 2026-11-03 05:10:41 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3713
Author: @ludovic111
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @ludovic111

Base: main ← Head: feat/launcher-post-exit


📝 Commits (3)

  • edd340a Launcher: a command after the game exits, and the instance's variables
  • 0914c90 Launcher: the post-exit test's Windows command keeps its last word
  • 0050a65 Merge remote-tracking branch 'origin/main' into feat/launcher-post-exit

📊 Changes

9 files changed (+221 additions, -15 deletions)

View changed files

📝 docs/launcher-commands.md (+2 -1)
📝 launcher/src/backend.rs (+6 -1)
📝 launcher/src/cli.rs (+34 -3)
📝 launcher/src/instances.rs (+9 -0)
📝 launcher/src/launch.rs (+78 -1)
📝 launcher/src/launch/tests.rs (+46 -0)
📝 launcher/src/launch_page.rs (+13 -1)
📝 launcher/src/main.rs (+27 -6)
📝 launcher/src/servers_page.rs (+6 -2)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

The next Prism gap, for every instance (Horizon and Java):

  • After the game: a shell command run in the instance's folder once the game has exited, whatever its exit status. It's set with instance launch <instance> --post-exit "<command>" or the launch panel's new "After the game" field.
    • Where it runs: the launcher starts it when it sees the game end: in the window on its own thread, with its output dropped; in the CLI in the terminal, waited for. Running it inside the game's shell would have kept that shell as the game's parent, so Stop (which kills one process) would have orphaned the game.
  • Instance variables: INST_NAME, INST_ID, INST_DIR and INST_MC_DIR (both the instance's game folder), plus INST_JAVA for a Java instance. They're set for the game, the pre-launch command, the wrapper and the post-exit command. They use the same names as Prism Launcher, so its users' scripts carry over.

Source of the gap: Prism Launcher wiki: Custom commands (the command types and the variable names). Nothing else was read.

Tests:

  • the_post_exit_command_runs_with_the_instance_variables runs a real post-exit command (/bin/sh, or cmd on Windows) and checks that the instance variables and the player's own variables reach it.
  • The summary line names it.

Nothing runs per frame. Not checked in a running game here: a Java instance needs a signed-in owner, and a Horizon one needs a prepared version in this scratch setup.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at b13b4f2c7, 2 min 35 s)

Check Result
Scope ✅ 9 files, +220 −15
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 416 run, FAILED (failures=1) (2 min 24 s)
rustfmt ➖ no Rust change
clippy ➖ no Rust change
tests ➖ no crate touched
doc tests ➖ no crate touched
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (3 s)
launcher clippy ✅ (2 s)
launcher tests ✅ 270 passed (5 s)
Parity ➖ 1 affected, to run in CI (--quick): lan_integration
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/3713 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/launcher-post-exit` --- ### 📝 Commits (3) - [`edd340a`](https://github.com/horizon-rust/horizon/commit/edd340a621f87308befa407457854d1bbcfb1625) Launcher: a command after the game exits, and the instance's variables - [`0914c90`](https://github.com/horizon-rust/horizon/commit/0914c90455118d585359654e4d8a69ec4a32bb04) Launcher: the post-exit test's Windows command keeps its last word - [`0050a65`](https://github.com/horizon-rust/horizon/commit/0050a65600a94248f68ec00680cb296b76821c4b) Merge remote-tracking branch 'origin/main' into feat/launcher-post-exit ### 📊 Changes **9 files changed** (+221 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `docs/launcher-commands.md` (+2 -1) 📝 `launcher/src/backend.rs` (+6 -1) 📝 `launcher/src/cli.rs` (+34 -3) 📝 `launcher/src/instances.rs` (+9 -0) 📝 `launcher/src/launch.rs` (+78 -1) 📝 `launcher/src/launch/tests.rs` (+46 -0) 📝 `launcher/src/launch_page.rs` (+13 -1) 📝 `launcher/src/main.rs` (+27 -6) 📝 `launcher/src/servers_page.rs` (+6 -2) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. The next Prism gap, for every instance (Horizon and Java): - **After the game:** a shell command run in the instance's folder once the game has exited, whatever its exit status. It's set with `instance launch <instance> --post-exit "<command>"` or the launch panel's new "After the game" field. - **Where it runs:** the launcher starts it when it sees the game end: in the window on its own thread, with its output dropped; in the CLI in the terminal, waited for. Running it inside the game's shell would have kept that shell as the game's parent, so Stop (which kills one process) would have orphaned the game. - **Instance variables:** `INST_NAME`, `INST_ID`, `INST_DIR` and `INST_MC_DIR` (both the instance's game folder), plus `INST_JAVA` for a Java instance. They're set for the game, the pre-launch command, the wrapper and the post-exit command. They use the same names as Prism Launcher, so its users' scripts carry over. Source of the gap: [Prism Launcher wiki: Custom commands](https://prismlauncher.org/wiki/help-pages/custom-commands/) (the command types and the variable names). Nothing else was read. Tests: - `the_post_exit_command_runs_with_the_instance_variables` runs a real post-exit command (`/bin/sh`, or `cmd` on Windows) and checks that the instance variables and the player's own variables reach it. - The summary line names it. Nothing runs per frame. Not checked in a running game here: a Java instance needs a signed-in owner, and a Horizon one needs a prepared version in this scratch setup. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at b13b4f2c7, 2 min 35 s) | Check | Result | | --- | --- | | Scope | ✅ 9 files, +220 −15 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 416 run, FAILED (failures=1) (2 min 24 s) | | rustfmt | ➖ no Rust change | | clippy | ➖ no Rust change | | tests | ➖ no crate touched | | doc tests | ➖ no crate touched | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (3 s) | | launcher clippy | ✅ (2 s) | | launcher tests | ✅ 270 passed (5 s) | | Parity | ➖ 1 affected, to run in CI (--quick): lan_integration | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:10:41 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#5164
No description provided.