diff --git a/packages/flutter_tools/lib/src/build_system/targets/shader_compiler.dart b/packages/flutter_tools/lib/src/build_system/targets/shader_compiler.dart index 827e571121..194d2f2bfb 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/shader_compiler.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/shader_compiler.dart @@ -181,12 +181,16 @@ class ShaderCompiler { final Process impellercProcess = await _processManager.start(cmd); final int code = await impellercProcess.exitCode; if (code != 0) { - _logger.printTrace(await utf8.decodeStream(impellercProcess.stdout)); - _logger.printError(await utf8.decodeStream(impellercProcess.stderr)); + final String stdout = await utf8.decodeStream(impellercProcess.stdout); + final String stderr = await utf8.decodeStream(impellercProcess.stderr); + _logger.printTrace(stdout); + _logger.printError(stderr); if (fatal) { throw ShaderCompilerException._( 'Shader compilation of "${input.path}" to "$outputPath" ' - 'failed with exit code $code.', + 'failed with exit code $code.\n' + 'impellerc stdout:\n$stdout\n' + 'impellerc stderr:\n$stderr', ); } return false; diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/shader_compiler_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/shader_compiler_test.dart index 299dbc3e17..39ff52598f 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/shader_compiler_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/shader_compiler_test.dart @@ -199,6 +199,8 @@ void main() { '--input-type=frag', '--include=$fragDir', ], + stdout: 'impellerc stdout', + stderr: 'impellerc stderr', exitCode: 1, ), ]); @@ -209,14 +211,18 @@ void main() { artifacts: artifacts, ); - await expectLater( - () => shaderCompiler.compileShader( + try { + await shaderCompiler.compileShader( input: fileSystem.file(notFragPath), outputPath: outputPath, target: ShaderTarget.sksl, - ), - throwsA(isA()), - ); + ); + fail('unreachable'); + } on ShaderCompilerException catch (e) { + expect(e.toString(), contains('impellerc stdout:\nimpellerc stdout')); + expect(e.toString(), contains('impellerc stderr:\nimpellerc stderr')); + } + expect(fileSystem.file(outputPath).existsSync(), false); });