fix: remove local used outside function in trainer subshell#435
Merged
garysheng merged 1 commit intoPeonPing:mainfrom Apr 3, 2026
Merged
fix: remove local used outside function in trainer subshell#435garysheng merged 1 commit intoPeonPing:mainfrom
local used outside function in trainer subshell#435garysheng merged 1 commit intoPeonPing:mainfrom
Conversation
|
@ImBIOS is attempting to deploy a commit to the Gary Sheng's projects Team on Vercel. A member of the Team first needs to authorize it. |
`local` is only valid inside functions in bash (POSIX spec). The trainer reminder block runs inside a ( ... ) & disown subshell at the top-level of peon.sh, not inside a function. This causes bash to emit: peon.sh: line 4428: local: can only be used in a function The subshell already provides variable isolation, so `local` was never actually scoping anything. Replace with a plain assignment. Closes PeonPing#434
b22b45e to
bbe80d5
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes a bash correctness issue in the “trainer reminder sound” background subshell by removing an invalid local declaration and replacing it with a normal variable assignment (the subshell already provides scope isolation), addressing the warning reported in #434.
Changes:
- Replace
local _trainer_focused=""with_trainer_focused=""inside the trainer reminder subshell to avoidlocal: can only be used in a functionwarnings.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Fixes #434
local _trainer_focused=""atpeon.sh:4428is inside a( ... ) & disownsubshell, not a function. In bash,localis only valid inside functions — it produces a warning and is otherwise a no-op. The subshell already provides variable isolation, so a plain assignment is correct.Changes
peon.sh:4428:local _trainer_focused=""→_trainer_focused=""Testing
The trainer reminder block still works identically — the subshell isolates the variable, and
localwas never actually providing any scoping benefit.