Fix "Restarting" screen stuck forever#337
Merged
3rdIteration merged 5 commits intodevfrom Mar 17, 2026
Merged
Conversation
…dcard The "Restarting" screen would stay on forever because `pidof python*` does not work — pidof does not support shell glob wildcards. The shell expands `python*` as a file glob (matching nothing), so pidof receives a literal `python*` which it cannot resolve. As a result, `kill` gets no PID arguments and the process is never terminated. Fix: Use `os.getpid()` for a reliable PID and `sys.executable` for the correct Python binary path, eliminating the dependency on pidof and hardcoded binary names. Co-authored-by: 3rdIteration <2230318+3rdIteration@users.noreply.github.com>
Addresses code review feedback: shell-escape the Python executable path to prevent issues if the path contains spaces or special characters. Co-authored-by: 3rdIteration <2230318+3rdIteration@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix issue with restarting screen not functioning
Fix "Restarting" screen stuck forever: pidof doesn't support wildcards
Mar 13, 2026
… test The screenshot generator exercises RestartView without mocking the DoResetThread. Now that the kill command actually works (os.getpid()), the thread was killing the test process. Fix: RestartView.run() wraps run_screen() in try/except to call thread.stop() on any exception (like ScreenshotComplete). DoResetThread checks keep_running before executing the kill, so stopped threads exit gracefully without killing the process. Co-authored-by: 3rdIteration <2230318+3rdIteration@users.noreply.github.com>
…est race - Add explanatory comment for the broad Exception catch in RestartView - Move shlex import to file-level in test_flows_view.py - Set keep_running directly instead of start()/stop() to avoid race Co-authored-by: 3rdIteration <2230318+3rdIteration@users.noreply.github.com>
Copilot
AI
changed the title
Fix "Restarting" screen stuck forever: pidof doesn't support wildcards
Fix "Restarting" screen stuck forever
Mar 14, 2026
There was a problem hiding this comment.
Pull request overview
Fixes SeedSigner’s “Restarting” screen hanging indefinitely by replacing unreliable process lookup (pidof python* / ps|grep) with a deterministic restart strategy based on the current PID and Python executable.
Changes:
- Restart now uses
os.getpid()to reliably target the current process, andsys.executable(quoted) to restart on seedsigner-os. - Added a safety stop-path: if
ResetScreenexits via exception, the reset thread is stopped to avoid killing the running process during screenshot/test scenarios. - Added unit tests validating the exact subprocess command constructed in each environment branch and verifying the “stopped thread” no-op behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/seedsigner/views/view.py |
Updates RestartView reset-thread behavior to kill by PID and restart using sys.executable, plus stops the thread on abnormal screen exit. |
tests/test_flows_view.py |
Adds tests that assert the constructed reset commands for seedsigner-os vs desktop and ensure the thread skips the kill when stopped. |
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.
Description
The restart screen hangs indefinitely because
pidof python*doesn't work —pidofdoesn't support shell globs. The wildcard expands against the current directory (matching nothing), sokillreceives no PID and the process is never terminated.Fix: Replace unreliable
pidof/ps+grepprocess lookup withos.getpid()andsys.executable:Additional changes:
DoResetThreadchecksself.keep_runningbefore executingkill.RestartView.run()stops the thread on exception. This prevents the now-functional kill from terminating the screenshot generator process (which exercisesRestartViewwithout mocking the thread).shlex.quote()onsys.executable;&→;so kill completes before exec.No screenshot changes —
ResetScreenUI is unchanged; only the background thread logic is fixed.This pull request is categorized as a:
Checklist
pytestand made sure all unit tests pass before sumbitting the PRIf you modified or added functionality/workflow, did you add new unit tests?
I have tested this PR on the following platforms/os:
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.