Show Xcode compilation errors at end of build, suppress stdout and stderr from Xcode (#113302)

This commit is contained in:
Jenn Magder
2022-10-17 10:47:25 -07:00
committed by GitHub
parent 3034a4ef39
commit f059dd40ea
10 changed files with 108 additions and 67 deletions

View File

@@ -97,11 +97,17 @@ class Context {
if (verbose) {
print((result.stdout as String).trim());
}
if ((result.stderr as String).isNotEmpty) {
echoError((result.stderr as String).trim());
final String resultStderr = result.stderr.toString().trim();
if (resultStderr.isNotEmpty) {
final StringBuffer errorOutput = StringBuffer();
if (result.exitCode != 0) {
// "error:" prefix makes this show up as an Xcode compilation error.
errorOutput.write('error: ');
}
errorOutput.write(resultStderr);
echoError(errorOutput.toString());
}
if (!allowFail && result.exitCode != 0) {
stderr.write('${result.stderr}\n');
throw Exception(
'Command "$bin ${args.join(' ')}" exited with code ${result.exitCode}',
);