@@ -53,6 +53,7 @@ struct Args {
53
53
pkg_path : Option < String > ,
54
54
gen_pkg_only : bool ,
55
55
build_only : bool ,
56
+ cargo_output : bool ,
56
57
clear_cache : bool ,
57
58
debug : bool ,
58
59
dep : Vec < String > ,
@@ -139,6 +140,11 @@ fn parse_args() -> Args {
139
140
/*
140
141
Options that impact the script being executed.
141
142
*/
143
+ . arg ( Arg :: with_name ( "cargo-output" )
144
+ . help ( "Show output from cargo when building." )
145
+ . short ( "o" )
146
+ . long ( "cargo-output" )
147
+ )
142
148
. arg ( Arg :: with_name ( "count" )
143
149
. help ( "Invoke the loop closure with two arguments: line, and line number." )
144
150
. long ( "count" )
@@ -279,6 +285,7 @@ fn parse_args() -> Args {
279
285
pkg_path : m. value_of ( "pkg_path" ) . map ( Into :: into) ,
280
286
gen_pkg_only : m. is_present ( "gen_pkg_only" ) ,
281
287
build_only : m. is_present ( "build_only" ) ,
288
+ cargo_output : m. is_present ( "cargo-output" ) ,
282
289
clear_cache : m. is_present ( "clear_cache" ) ,
283
290
debug : m. is_present ( "debug" ) ,
284
291
dep : owned_vec_string ( m. values_of ( "dep" ) ) ,
@@ -637,13 +644,14 @@ fn gen_pkg_and_compile(input: &Input, action: &InputAction) -> MainResult<()> {
637
644
& meta,
638
645
) ?;
639
646
640
- macro_rules! get_status {
641
- ( $ cmd: expr ) => {
642
- util :: suppress_child_output ( & mut $cmd ) ? . status ( )
643
- } ;
644
- }
647
+ let exit_status = if action . cargo_output {
648
+ cmd. spawn ( ) ? . wait ( )
649
+ } else {
650
+ util :: suppress_child_output ( & mut cmd ) ? . status ( )
651
+ } ;
645
652
646
- let compile_err = get_status ! ( cmd)
653
+ let compile_err =
654
+ exit_status
647
655
. map_err ( Into :: < MainError > :: into)
648
656
. and_then ( |st| match st. code ( ) {
649
657
Some ( 0 ) => Ok ( ( ) ) ,
@@ -691,6 +699,9 @@ struct InputAction {
691
699
/// Compile the input into a fresh executable?
692
700
compile : bool ,
693
701
702
+ /// Always show cargo output?
703
+ cargo_output : bool ,
704
+
694
705
/**
695
706
Force Cargo to do a recompile, even if it thinks it doesn't have to.
696
707
@@ -853,6 +864,7 @@ fn decide_action_for(
853
864
854
865
let mut action = InputAction {
855
866
compile : force,
867
+ cargo_output : args. cargo_output ,
856
868
force_compile : force,
857
869
emit_metadata : true ,
858
870
execute : !build_only,
0 commit comments