Skip to content

fix restart after the running exe is replaced on linux - #218

Merged
jaemk merged 1 commit into
masterfrom
261026.restart-deleted-exe
Oct 26, 2026
Merged

jaemk merged 1 commit into
masterfrom
261026.restart-deleted-exe

Conversation

@jaemk

@jaemk jaemk commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Fixes #217

  • Record the pre-replace current_exe() path in install_binary after an in-place self_replace, and restart into it. On linux current_exe() reports "<path> (deleted)" once the running inode is unlinked, so restart() exec'd a missing file.
  • Fall back to stripping the " (deleted)" suffix (linux/android only) when no path was recorded and the stripped path exists.
  • Add restart_with_reexecs_after_exe_replaced_on_disk to tests/restart.rs: a copy of the test binary renames a fresh copy over itself, then calls restart_with. Fails with No such file or directory before the fix.
  • Add unit tests for the recorded-path precedence and the suffix handling, and update specs/ref-restart.md and CHANGELOG.md.

…ed)"

On linux `current_exe()` reads `/proc/self/exe`, which reports "<path> (deleted)" once `self_replace` unlinks the running inode, so `restart()` exec'd a missing file (#217). `install_binary` now records the pre-replace path for `restart`, and `restart` falls back to stripping the suffix when nothing was recorded.
@jaemk
jaemk merged commit 4c500f3 into master Oct 26, 2026
4 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.

restart::restart() does not seem to work

1 participant