-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Problem
After running promptcode update on Unix/macOS systems, the first --version command shows the old version instead of the new one. The user must run --version twice to see the correct version.
Root Cause
The update process stages the new binary as .new and applies it on the next run. However, when the old binary finalizes the update (swaps files), it continues running with its baked-in old version string.
Solution
Implement re-exec after finalization: After successfully swapping binaries, the process should re-execute itself with the same arguments, ensuring the new binary handles the command.
Implementation
- Use
spawnSyncinstead ofexecSyncfor safer execution - Add exclusive locking to prevent race conditions
- Properly propagate exit codes and signals
- Implement atomic operations with rollback capability
- Handle symlinks, permissions, and platform differences correctly
This ensures promptcode --version shows the correct version immediately after an update.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working