diff --git a/web/_tool/build_ci.dart b/web/_tool/build_ci.dart index d73f0e0c7..29bf7c50b 100644 --- a/web/_tool/build_ci.dart +++ b/web/_tool/build_ci.dart @@ -16,8 +16,8 @@ main() async { ]; print('Building the sample index...'); - await run('samples_index', 'pub', ['get']); - await run('samples_index', 'pub', ['run', 'grinder', 'deploy']); + await _run('samples_index', 'pub', ['get']); + await _run('samples_index', 'pub', ['run', 'grinder', 'deploy']); // Create the directory each Flutter Web sample lives in Directory(p.join(Directory.current.path, 'samples_index', 'public', 'web')) @@ -36,8 +36,17 @@ main() async { 'public', 'web', directoryName); // Build the sample and copy the files - await run(directory, 'flutter', ['pub', 'get']); - await run(directory, 'flutter', ['build', 'web']); - await run(directory, 'mv', [sourceBuildDir, targetDirectory]); + await _run(directory, 'flutter', ['pub', 'get']); + await _run(directory, 'flutter', ['build', 'web']); + await _run(directory, 'mv', [sourceBuildDir, targetDirectory]); + } +} + +// Invokes run() and exits if the sub-process failed. +Future _run( + String workingDir, String commandName, List args) async { + var success = await run(workingDir, commandName, args); + if (!success) { + exit(1); } }