Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return xcodebuild error message to client #888

Merged
merged 1 commit into from
Mar 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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