Skip to content

fix: Use /proc/self/exe for real binary path on Linux#7

Merged
shahariaazam merged 1 commit intomainfrom
fix-self-update
Nov 6, 2025
Merged

fix: Use /proc/self/exe for real binary path on Linux#7
shahariaazam merged 1 commit intomainfrom
fix-self-update

Conversation

@shahariaazam
Copy link
Copy Markdown
Member

Issue

Self-update was failing because Bun compiled binaries use a virtual filesystem path (//root/) internally, which doesn't exist on the actual filesystem.

Solution

Use /proc/self/exe on Linux to get the real filesystem path of the running binary.

Testing

✅ Tested locally with version 0.0.1 updating to 0.1.0
✅ Update completed successfully
✅ Binary replaced correctly at real path

Changes

  • Use /proc/self/exe for Linux (works with Bun virtual FS)
  • Better error handling for unsupported platforms
  • Verified working in ~/.local/bin/ directory

Before

❌ Error: ENOENT: no such file or directory, rename '//root/gscli-linux'

After

✅ Successfully updated to v0.1.0

- Use /proc/self/exe to get real filesystem path instead of Bun virtual path
- Fixes self-update issue with //root/ virtual paths
- Tested and verified: update works correctly
- Better error handling for unsupported platforms
- Removes unused readlinkSync import
@shahariaazam shahariaazam merged commit 91e6d3a into main Nov 6, 2025
1 check passed
@shahariaazam shahariaazam deleted the fix-self-update branch November 6, 2025 23:32
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.

1 participant