fix: handle removing active versions#163
Merged
hendriknielaender merged 2 commits intoMay 20, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes the hang and unresponsive Ctrl+C when removing the currently active Zig/ZLS version. The confirmation prompt is now visible (progress rendering disabled for remove), reads a single line so y+Enter returns immediately, can be interrupted by Ctrl+C, and the removal correctly clears default_version while leaving the shim in place with a clear "no active version" message.
Changes:
- Make the destructive-confirmation prompt non-blocking-friendly: read until newline and exit on
Ctrl+Cvia newsignals.begin/end_blocking_waithelpers; disable progress rendering whenprogress_itemsreturns 0 (now the case forremove). - On removing the active Zig version, clear the
default_versionfile; keep shims in place and have them report a clear "No active … version selected" error. - Add e2e coverage for removing the active Zig and ZLS versions, plus
assert_path_exists/assert_path_missinghelpers.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/util/confirm.zig | Switch to line-delimited read and wrap stdin wait with signal helpers so Ctrl+C interrupts. |
| src/platform/signals.zig | Add begin/end_blocking_wait and exit on interrupt if a blocking wait or already-requested interrupt is in progress. |
| src/main.zig | Move shim dispatch after output-mode setup; disable progress printing when progress_item_count == 0. |
| src/core/remove.zig | New clear_default_if_active to delete default_version when removing the active Zig version. |
| src/core/remove_installed.zig | Return 0 progress items so progress UI is suppressed for remove. |
| src/shim.zig | Detect missing tool path and print a clear "no active version" error instead of a raw FileNotFound. |
| tests/e2e.zig | New e2e tests for removing active Zig/ZLS versions and path-existence assertion helpers. |
Comments suppressed due to low confidence (1)
tests/e2e.zig:753
- Same comptime format-mismatch as in
test_remove_active_zig: the format string"{s}{c}.zm{c}bin{c}{s}"has 5 placeholders but 6 arguments are passed (one extrastd.fs.path.sep). This will fail to compile understd.fmt.bufPrint's comptime checks.
var shim_path_buffer: [sandbox_path_max]u8 = undefined;
const shim_path = try std.fmt.bufPrint(
&shim_path_buffer,
"{s}{c}.zm{c}bin{c}{s}",
.{ sandbox, std.fs.path.sep, std.fs.path.sep, std.fs.path.sep, zls_name },
);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
Ready for review❤️ |
ac019bd
into
hendriknielaender:main
11 of 12 checks passed
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.
Summary
Closes #162.
This PR fixes the case where removing the currently active Zig/ZLS version looks like it hangs.
The confirmation prompt now shows normally,
ycontinues immediately, andCtrl+Cexits while waiting for input.After removing the active version, zvm leaves that tool with no active version selected. The shim stays in place and prints a clear error if there is no active version.
Main changes:
removeCtrl+Cdefault_versionwhen the removed active Zig version matches itzig/zlsshims after removing the active versionVerification