@@ -185,12 +185,14 @@ fn check_exercises_unsolved(
185
185
return None ;
186
186
}
187
187
188
- Some ( (
189
- exercise_info. name . as_str ( ) ,
190
- thread:: spawn ( || exercise_info. run_exercise ( None , cmd_runner) ) ,
191
- ) )
188
+ Some (
189
+ thread:: Builder :: new ( )
190
+ . spawn ( || exercise_info. run_exercise ( None , cmd_runner) )
191
+ . map ( |handle| ( exercise_info. name . as_str ( ) , handle) ) ,
192
+ )
192
193
} )
193
- . collect :: < Vec < _ > > ( ) ;
194
+ . collect :: < Result < Vec < _ > , _ > > ( )
195
+ . context ( "Failed to spawn a thread to check if an exercise is already solved" ) ?;
194
196
195
197
let n_handles = handles. len ( ) ;
196
198
write ! ( stdout, "Progress: 0/{n_handles}" ) ?;
@@ -226,7 +228,9 @@ fn check_exercises(info_file: &'static InfoFile, cmd_runner: &'static CmdRunner)
226
228
Ordering :: Equal => ( ) ,
227
229
}
228
230
229
- let handle = thread:: spawn ( move || check_exercises_unsolved ( info_file, cmd_runner) ) ;
231
+ let handle = thread:: Builder :: new ( )
232
+ . spawn ( move || check_exercises_unsolved ( info_file, cmd_runner) )
233
+ . context ( "Failed to spawn a thread to check if any exercise is already solved" ) ?;
230
234
231
235
let info_file_paths = check_info_file_exercises ( info_file) ?;
232
236
check_unexpected_files ( "exercises" , & info_file_paths) ?;
@@ -253,7 +257,7 @@ fn check_solutions(
253
257
. exercises
254
258
. iter ( )
255
259
. map ( |exercise_info| {
256
- thread:: spawn ( move || {
260
+ thread:: Builder :: new ( ) . spawn ( move || {
257
261
let sol_path = exercise_info. sol_path ( ) ;
258
262
if !Path :: new ( & sol_path) . exists ( ) {
259
263
if require_solutions {
@@ -274,7 +278,8 @@ fn check_solutions(
274
278
}
275
279
} )
276
280
} )
277
- . collect :: < Vec < _ > > ( ) ;
281
+ . collect :: < Result < Vec < _ > , _ > > ( )
282
+ . context ( "Failed to spawn a thread to check a solution" ) ?;
278
283
279
284
let mut sol_paths = hash_set_with_capacity ( info_file. exercises . len ( ) ) ;
280
285
let mut fmt_cmd = Command :: new ( "rustfmt" ) ;
@@ -322,7 +327,11 @@ fn check_solutions(
322
327
}
323
328
stdout. write_all ( b"\n " ) ?;
324
329
325
- let handle = thread:: spawn ( move || check_unexpected_files ( "solutions" , & sol_paths) ) ;
330
+ let handle = thread:: Builder :: new ( )
331
+ . spawn ( move || check_unexpected_files ( "solutions" , & sol_paths) )
332
+ . context (
333
+ "Failed to spawn a thread to check for unexpected files in the solutions directory" ,
334
+ ) ?;
326
335
327
336
if !fmt_cmd
328
337
. status ( )
0 commit comments