Skip to content

Commit

Permalink
return xcodebuild error message (appium#888)
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa authored Mar 9, 2019
1 parent a38ad6f commit 8138e8f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/wda/xcodebuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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}`;
}
}
}
}
Expand All @@ -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
Expand All @@ -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) {
Expand Down

0 comments on commit 8138e8f

Please sign in to comment.