Skip to content

fix: keep terminal helper script alive until child exits - #88

Open
alexsmolya wants to merge 1 commit into
CachyOS:developfrom
alexsmolya:fix/issue-87-terminal-script-lifetime
Open

fix: keep terminal helper script alive until child exits#88
alexsmolya wants to merge 1 commit into
CachyOS:developfrom
alexsmolya:fix/issue-87-terminal-script-lifetime

Conversation

@alexsmolya

Copy link
Copy Markdown

terminal-helper currently deletes the generated temporary script after the terminal launcher returns. However, kgx --wait does not guarantee that the child has already consumed the script, so the command can fail before pkexec/bash opens it.

This change:

  • moves normal cleanup ownership into the generated script with an EXIT trap that preserves the child exit status;
  • keeps launch-failure cleanup parent-owned;
  • leaves terminal selection, the pkexec flow, and package/kernel command construction unchanged;
  • adds a deterministic regression test covering delayed child startup, the rootshell.sh/pkexec path, non-zero child exit, and terminal launch failure.

Validation:

  • bash -n src/terminal-helper src/rootshell.sh tests/terminal-helper_test.sh
  • tests/terminal-helper_test.sh
  • git diff --check

The tests use harmless marker commands only; no real package, kernel, or root operation is needed.

Fixes #87

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.

cachyos-kernel-manager fails to execute kernel operations because temporary script is deleted before pkexec runs

1 participant