File tree Expand file tree Collapse file tree 1 file changed +16
-14
lines changed Expand file tree Collapse file tree 1 file changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ Some text is exempt from wrapping:
155
155
156
156
let cfg = Config :: new ( & m) ;
157
157
if let Err ( ref e) = cfg {
158
- fatal ( e) ;
158
+ exit_abnormally ( e) ;
159
159
}
160
160
let cfg = cfg. unwrap ( ) ;
161
161
@@ -166,16 +166,8 @@ Some text is exempt from wrapping:
166
166
. map ( |text| commitmsgfmt. filter ( & text) )
167
167
. and_then ( to_stdout) ;
168
168
169
- match result {
170
- Ok ( ( ) ) => ( ) ,
171
- Err ( ref err) => match * err {
172
- CliError :: Io ( ref e) if e. kind ( ) == io:: ErrorKind :: BrokenPipe => {
173
- std:: process:: exit ( 141 /* 128 + 13 */ ) ;
174
- }
175
- _ => {
176
- fatal ( err) ;
177
- }
178
- } ,
169
+ if let Err ( ref e) = result {
170
+ exit_abnormally ( e) ;
179
171
}
180
172
}
181
173
@@ -207,9 +199,19 @@ fn to_stdout<'a>(msg: String) -> CliResult<'a, ()> {
207
199
Ok ( ( ) )
208
200
}
209
201
210
- fn fatal ( e : & CliError ) {
211
- eprintln ! ( "fatal: {}" , e) ;
212
- :: std:: process:: exit ( 1 ) ;
202
+ fn exit_abnormally ( e : & CliError ) {
203
+ let ret = match e {
204
+ CliError :: Io ( ref e) if e. kind ( ) == io:: ErrorKind :: BrokenPipe => {
205
+ let ret = 128 + 13 ;
206
+ debug_assert ! ( ret == 141 ) ;
207
+ ret
208
+ }
209
+ _ => {
210
+ eprintln ! ( "fatal: {}" , e) ;
211
+ 1
212
+ }
213
+ } ;
214
+ :: std:: process:: exit ( ret) ;
213
215
}
214
216
215
217
#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments