From b24a932104984fbbf6e9a124cbbe731e92a2ed72 Mon Sep 17 00:00:00 2001 From: Dylan Bettermann Date: Thu, 20 Jul 2023 08:00:51 -0500 Subject: [PATCH] Always respect select flag during install --- Sources/xcodes/App.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sources/xcodes/App.swift b/Sources/xcodes/App.swift index 00a1ef3..95e9fff 100644 --- a/Sources/xcodes/App.swift +++ b/Sources/xcodes/App.swift @@ -290,6 +290,16 @@ struct Xcodes: AsyncParsableCommand { return xcodeInstaller.install(installation, dataSource: globalDataSource.dataSource, downloader: downloader, destination: destination, experimentalUnxip: experimentalUnxip, emptyTrash: emptyTrash, noSuperuser: noSuperuser) } } + .recover { error -> Promise in + if select, case let XcodeInstaller.Error.versionAlreadyInstalled(installedXcode) = error { + Current.logging.log(error.legibleLocalizedDescription.green) + return Promise { seal in + seal.fulfill(installedXcode) + } + } else { + throw error + } + } .then { xcode -> Promise in if select { return selectXcode(shouldPrint: print, pathOrVersion: xcode.path.string, directory: destination, fallbackToInteractive: false)