File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,12 @@ struct Uninstall: SwiftlyCommand {
5656 }
5757 } else {
5858 let selector = try ToolchainSelector ( parsing: self . toolchain)
59- toolchains = startingConfig. listInstalledToolchains ( selector: selector)
59+ var installedToolchains = startingConfig. listInstalledToolchains ( selector: selector)
60+ // This is in the unusual case that the inUse toolchain is not listed in the installed toolchains
61+ if let inUse = startingConfig. inUse, selector. matches ( toolchain: inUse) && !startingConfig. installedToolchains. contains ( inUse) {
62+ installedToolchains. append ( inUse)
63+ }
64+ toolchains = installedToolchains
6065 }
6166
6267 guard !toolchains. isEmpty else {
@@ -117,13 +122,14 @@ struct Uninstall: SwiftlyCommand {
117122
118123 static func execute( _ toolchain: ToolchainVersion , _ config: inout Config ) async throws {
119124 SwiftlyCore . print ( " Uninstalling \( toolchain) ... " , terminator: " " )
120- try Swiftly . currentPlatform. uninstall ( toolchain)
121125 config. installedToolchains. remove ( toolchain)
122126 // This is here to prevent the inUse from referencing a toolchain that is not installed
123127 if config. inUse == toolchain {
124128 config. inUse = nil
125129 }
126130 try config. save ( )
131+
132+ try Swiftly . currentPlatform. uninstall ( toolchain)
127133 SwiftlyCore . print ( " done " )
128134 }
129135}
You can’t perform that action at this time.
0 commit comments