File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -144,6 +144,7 @@ struct MultiWriter {
144144 writers : Vec < NamedWriter > ,
145145 output_error_mode : Option < OutputErrorMode > ,
146146 ignored_errors : usize ,
147+ aborted : Option < Error > ,
147148}
148149
149150impl MultiWriter {
@@ -186,6 +187,7 @@ impl MultiWriter {
186187 writers,
187188 output_error_mode,
188189 ignored_errors : 0 ,
190+ aborted : None ,
189191 }
190192 }
191193
@@ -194,7 +196,6 @@ impl MultiWriter {
194196 }
195197
196198 fn write_flush ( & mut self , buf : & [ u8 ] ) -> Result < ( ) > {
197- let mut aborted = None ;
198199 let mode = self . output_error_mode ;
199200 self . writers . retain_mut ( |writer| {
200201 let res = ( || {
@@ -205,13 +206,13 @@ impl MultiWriter {
205206 Ok ( ( ) ) => true ,
206207 Err ( e) => {
207208 if let Err ( e) = process_error ( mode, e, writer, & mut self . ignored_errors ) {
208- aborted. get_or_insert ( e) ;
209+ self . aborted . get_or_insert ( e) ;
209210 }
210211 false
211212 }
212213 }
213214 } ) ;
214- aborted. map_or (
215+ self . aborted . take ( ) . map_or (
215216 if self . writers . is_empty ( ) {
216217 // This error kind will never be raised by the standard
217218 // library, so we can use it for early termination of
You can’t perform that action at this time.
0 commit comments