Skip to content

fix: remove local used outside function in trainer subshell#435

Merged
garysheng merged 1 commit intoPeonPing:mainfrom
ImBIOS:fix/trainer-local-subshell
Apr 3, 2026
Merged

fix: remove local used outside function in trainer subshell#435
garysheng merged 1 commit intoPeonPing:mainfrom
ImBIOS:fix/trainer-local-subshell

Conversation

@ImBIOS
Copy link
Copy Markdown
Contributor

@ImBIOS ImBIOS commented Apr 3, 2026

Summary

Fixes #434

local _trainer_focused="" at peon.sh:4428 is inside a ( ... ) & disown subshell, not a function. In bash, local is 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 local was never actually providing any scoping benefit.

Copilot AI review requested due to automatic review settings April 3, 2026 10:12
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 3, 2026

@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
@ImBIOS ImBIOS force-pushed the fix/trainer-local-subshell branch from b22b45e to bbe80d5 Compare April 3, 2026 10:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 avoid local: can only be used in a function warnings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@garysheng garysheng merged commit eb059fd into PeonPing:main Apr 3, 2026
2 of 3 checks passed
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.

fix: local used outside function in trainer subshell (peon.sh:4428)

3 participants