From bc58a7832fa8b992439cbf031596b7ec4006b5f5 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Fri, 8 Mar 2019 22:56:01 +0900 Subject: [PATCH] return xcodebuild error message --- lib/wda/xcodebuild.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/wda/xcodebuild.js b/lib/wda/xcodebuild.js index cdd2f134f..0002fb91b 100644 --- a/lib/wda/xcodebuild.js +++ b/lib/wda/xcodebuild.js @@ -8,6 +8,7 @@ import { fixForXcode7, fixForXcode9, setRealDeviceSecurity, generateXcodeConfigF WDA_RUNNER_BUNDLE_ID, getWDAUpgradeTimestamp } from './utils'; import _ from 'lodash'; import path from 'path'; +import { EOL } from 'os'; const DEFAULT_SIGNING_ID = 'iPhone Developer'; @@ -266,8 +267,11 @@ class XcodeBuild { if (logXcodeOutput) { // do not log permission errors from trying to write to attachments folder if (!out.includes('Error writing attachment data to file')) { - for (const line of out.split('\n')) { + for (const line of out.split(EOL)) { xcodeLog.error(line); + if (line) { + xcodebuild._wda_error_message += `${EOL}${line}`; + } } } } @@ -278,6 +282,8 @@ class XcodeBuild { async start (buildOnly = false) { this.xcodebuild = await this.createSubProcess(buildOnly); + // Store xcodebuild message + this.xcodebuild._wda_error_message = ''; // wrap the start procedure in a promise so that we can catch, and report, // any startup errors that are thrown as events @@ -298,7 +304,8 @@ class XcodeBuild { } this.xcodebuild.processExited = true; if (this.xcodebuild._wda_error_occurred || (!signal && code !== 0)) { - return reject(new Error(`xcodebuild failed with code ${code}`)); + return reject(new Error(`xcodebuild failed with code ${code}${EOL}` + + `xcodebuild error message:${EOL}${this.xcodebuild._wda_error_message}`)); } // in the case of just building, the process will exit and that is our finish if (buildOnly) {