@@ -81,29 +81,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
81
81
}
82
82
} ;
83
83
84
- ops:: run ( & ws, & compile_opts, & values_os ( args, "args" ) ) . map_err ( |err| {
85
- let proc_err = match err. downcast_ref :: < ProcessError > ( ) {
86
- Some ( e) => e,
87
- None => return CliError :: new ( err, 101 ) ,
88
- } ;
89
-
90
- // If we never actually spawned the process then that sounds pretty
91
- // bad and we always want to forward that up.
92
- let exit_code = match proc_err. code {
93
- Some ( exit) => exit,
94
- None => return CliError :: new ( err, 101 ) ,
95
- } ;
96
-
97
- // If `-q` was passed then we suppress extra error information about
98
- // a failed process, we assume the process itself printed out enough
99
- // information about why it failed so we don't do so as well
100
- let is_quiet = config. shell ( ) . verbosity ( ) == Verbosity :: Quiet ;
101
- if is_quiet {
102
- CliError :: code ( exit_code)
103
- } else {
104
- CliError :: new ( err, exit_code)
105
- }
106
- } )
84
+ ops:: run ( & ws, & compile_opts, & values_os ( args, "args" ) ) . map_err ( |err| to_run_error ( config, err) )
107
85
}
108
86
109
87
pub fn is_manifest_command ( arg : & str ) -> bool {
@@ -118,3 +96,27 @@ pub fn exec_manifest_command(config: &Config, cmd: &str, _args: &[&OsStr]) -> Cl
118
96
119
97
todo ! ( "support for running manifest-commands is not yet implemented" )
120
98
}
99
+
100
+ fn to_run_error ( config : & cargo:: util:: Config , err : anyhow:: Error ) -> CliError {
101
+ let proc_err = match err. downcast_ref :: < ProcessError > ( ) {
102
+ Some ( e) => e,
103
+ None => return CliError :: new ( err, 101 ) ,
104
+ } ;
105
+
106
+ // If we never actually spawned the process then that sounds pretty
107
+ // bad and we always want to forward that up.
108
+ let exit_code = match proc_err. code {
109
+ Some ( exit) => exit,
110
+ None => return CliError :: new ( err, 101 ) ,
111
+ } ;
112
+
113
+ // If `-q` was passed then we suppress extra error information about
114
+ // a failed process, we assume the process itself printed out enough
115
+ // information about why it failed so we don't do so as well
116
+ let is_quiet = config. shell ( ) . verbosity ( ) == Verbosity :: Quiet ;
117
+ if is_quiet {
118
+ CliError :: code ( exit_code)
119
+ } else {
120
+ CliError :: new ( err, exit_code)
121
+ }
122
+ }
0 commit comments