@@ -380,7 +380,7 @@ abstract class Repository {
380380
381381 /// Determines if one ref is an ancestor for another.
382382 Future <bool > isAncestor (String possibleAncestor, String possibleDescendant) async {
383- final int exitcode = await git.run (
383+ final io. ProcessResult result = await git.run (
384384 < String > [
385385 'merge-base' ,
386386 '--is-ancestor' ,
@@ -391,18 +391,18 @@ abstract class Repository {
391391 allowNonZeroExitCode: true ,
392392 workingDirectory: (await checkoutDirectory).path,
393393 );
394- return exitcode == 0 ;
394+ return result.exitCode == 0 ;
395395 }
396396
397397 /// Determines if a given commit has a tag.
398398 Future <bool > isCommitTagged (String commit) async {
399- final int exitcode = await git.run (
399+ final io. ProcessResult result = await git.run (
400400 < String > ['describe' , '--exact-match' , '--tags' , commit],
401401 'verify $commit is already tagged' ,
402402 allowNonZeroExitCode: true ,
403403 workingDirectory: (await checkoutDirectory).path,
404404 );
405- return exitcode == 0 ;
405+ return result.exitCode == 0 ;
406406 }
407407
408408 /// Resets repository HEAD to [ref] .
@@ -480,16 +480,27 @@ abstract class Repository {
480480 }
481481 authorArg = '--author="$author "' ;
482482 }
483- await git.run (
484- < String > [
485- 'commit' ,
486- '--message' ,
487- message,
488- if (authorArg != null ) authorArg,
489- ],
483+ final List <String > commitCmd = < String > [
484+ 'commit' ,
485+ '--message' ,
486+ message,
487+ if (authorArg != null ) authorArg,
488+ ];
489+ stdio.printTrace ('Executing git $commitCmd ...' );
490+ final io.ProcessResult commitResult = await git.run (
491+ commitCmd,
490492 'commit changes' ,
491493 workingDirectory: (await checkoutDirectory).path,
492494 );
495+ final String stdout = commitResult.stdout as String ;
496+ if (stdout.isNotEmpty) {
497+ stdio.printTrace (stdout);
498+ }
499+ final String stderr = commitResult.stderr as String ;
500+ if (stderr.isNotEmpty) {
501+ stdio.printTrace (stderr);
502+ }
503+
493504 return reverseParse ('HEAD' );
494505 }
495506
@@ -608,13 +619,6 @@ class FrameworkRepository extends Repository {
608619 ]);
609620 }
610621
611- Future <io.ProcessResult > runDart (List <String > args) async {
612- return processManager.run (< String > [
613- fileSystem.path.join ((await checkoutDirectory).path, 'bin' , 'dart' ),
614- ...args,
615- ]);
616- }
617-
618622 Future <io.ProcessResult > runFlutter (List <String > args) async {
619623 await _ensureToolReady ();
620624 return processManager.run (< String > [
@@ -623,16 +627,27 @@ class FrameworkRepository extends Repository {
623627 ]);
624628 }
625629
630+ Future <void > streamDart (List <String > args) async => _streamProcess (< String > [
631+ fileSystem.path.join ((await checkoutDirectory).path, 'bin' , 'dart' ),
632+ ...args,
633+ ]);
634+
626635 Future <io.Process > streamFlutter (
627636 List <String > args, {
628637 void Function (String )? stdoutCallback,
629638 void Function (String )? stderrCallback,
639+ }) async => _streamProcess (< String > [
640+ fileSystem.path.join ((await checkoutDirectory).path, 'bin' , 'flutter' ),
641+ ...args,
642+ ]);
643+
644+ Future <io.Process > _streamProcess (
645+ List <String > cmd, {
646+ void Function (String )? stdoutCallback,
647+ void Function (String )? stderrCallback,
630648 }) async {
631- await _ensureToolReady ();
632- final io.Process process = await processManager.start (< String > [
633- fileSystem.path.join ((await checkoutDirectory).path, 'bin' , 'flutter' ),
634- ...args,
635- ]);
649+ stdio.printTrace ('Executing $cmd ...' );
650+ final io.Process process = await processManager.start (cmd);
636651 process
637652 .stdout
638653 .transform (utf8.decoder)
@@ -643,6 +658,15 @@ class FrameworkRepository extends Repository {
643658 .transform (utf8.decoder)
644659 .transform (const LineSplitter ())
645660 .listen (stderrCallback ?? stdio.printError);
661+ final int exitCode = await process.exitCode;
662+ if (exitCode != 0 ) {
663+ throw io.ProcessException (
664+ cmd.first,
665+ cmd.sublist (1 ),
666+ 'Process failed' ,
667+ exitCode,
668+ );
669+ }
646670 return process;
647671 }
648672
0 commit comments