diff --git a/services/xcode-select-service.ts b/services/xcode-select-service.ts index 5749d286..b3e87158 100644 --- a/services/xcode-select-service.ts +++ b/services/xcode-select-service.ts @@ -30,8 +30,12 @@ export class XcodeSelectService implements IXcodeSelectService { @cache() public async getXcodeVersion(): Promise { let sysInfoBase = this.$injector.resolve("sysInfoBase"); - let xcodeVer = await sysInfoBase.getXCodeVersion(), - xcodeVersionMatch = xcodeVer.match(/Xcode (.*)/), + let xcodeVer = await sysInfoBase.getXCodeVersion(); + if (!xcodeVer) { + this.$errors.failWithoutHelp("xcodebuild execution failed. Make sure that you have latest Xcode and tools installed."); + } + + let xcodeVersionMatch = xcodeVer.match(/Xcode (.*)/), xcodeVersionGroup = xcodeVersionMatch && xcodeVersionMatch[1], xcodeVersionSplit = xcodeVersionGroup && xcodeVersionGroup.split("."); diff --git a/sys-info-base.ts b/sys-info-base.ts index da532c3f..50cc1d73 100644 --- a/sys-info-base.ts +++ b/sys-info-base.ts @@ -60,12 +60,7 @@ export class SysInfoBase implements ISysInfo { private xCodeVerCache: string = null; public async getXCodeVersion(): Promise { if (!this.xCodeVerCache) { - try { - this.xCodeVerCache = this.$hostInfo.isDarwin ? await this.exec("xcodebuild -version") : null; - } catch (e) { - this.$logger.trace(`Command "xcodebuild -version" failed: ${e}`); - this.xCodeVerCache = null; - } + this.xCodeVerCache = this.$hostInfo.isDarwin ? await this.exec("xcodebuild -version") : null; } return this.xCodeVerCache; @@ -207,6 +202,7 @@ export class SysInfoBase implements ISysInfo { } } catch (e) { // if we got an error, assume not working + this.$logger.trace(`Error while executing ${cmd}: ${e.message}`); } return null;