Repository navigation
terminal-helper: remove scripts after execution - #292
Open
myakupozluk wants to merge 1 commit into
Open
myakupozluk wants to merge 1 commit into
myakupozluk wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new self-cleanup line is appended after the existing kgx SIGQUIT logic, which can prevent the cleanup rm from running and leave temporary scripts behind.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adjusts terminal-helper’s temporary-script lifecycle so GNOME Console (kgx) can’t race with the helper deleting the script before pkexec/bash starts it, by shifting cleanup into the generated script itself.
Changes:
- Write the generated script content using
printf(instead ofecho) for more predictable newline handling. - Append a self-cleanup
rmline into the generated temporary script. - Remove the helper’s unconditional post-launch
rmto avoid deleting the script too early (while keeping immediate cleanup on non-kgxlaunch failure).
File summaries
| File | Description |
|---|---|
| src/scripts/terminal-helper | Moves temp-script cleanup into the generated script to avoid kgx/pkexec race conditions. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+102
to
103
| printf 'rm -f -- %q\n' "$file" >>"$file" | ||
| eval "${terminals[${terminal}]}" 2>/dev/null || { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This fixes the race where GNOME Console can let the helper exit and delete the script before
pkexecstarts it.Closes #287
Validation
bash -n src/scripts/terminal-helperalacrittyand verified the command completed and the temporary script was removed afterwardsgit diff --check