@@ -407,23 +407,23 @@ impl WorkerState {
407407 /// threads (for --exec).
408408 fn receive ( & self , rx : Receiver < Batch > ) -> ExitCode {
409409 let config = & self . config ;
410-
411410 // This will be set to `Some` if the `--exec` argument was supplied.
412411 if let Some ( ref cmd) = config. command {
413- if cmd. in_batch_mode ( ) {
414- let mut results: Vec < WorkerResult > = rx. into_iter ( ) . flatten ( ) . collect ( ) ;
415- if let Some ( sort_key) = config. sort_key {
416- sort_worker_results ( & mut results, sort_key) ;
417- }
418- exec:: batch ( results, cmd, config)
419- } else if let Some ( sort_key) = config. sort_key {
412+ if let Some ( sort_key) = config. sort_key {
420413 // With --sort, we must collect all results before dispatching,
421414 // and run sequentially so the order is preserved.
422-
423415 let mut results: Vec < WorkerResult > = rx. into_iter ( ) . flatten ( ) . collect ( ) ;
424416 sort_worker_results ( & mut results, sort_key) ;
425- exec:: job ( results, cmd, config)
417+ if cmd. in_batch_mode ( ) {
418+ exec:: batch ( results, cmd, config)
419+ } else {
420+ exec:: job ( results, cmd, config)
421+ }
422+ } else if cmd. in_batch_mode ( ) {
423+ // Batch mode without sorting.
424+ exec:: batch ( rx. into_iter ( ) . flatten ( ) , cmd, config)
426425 } else {
426+ // No sort. Not Batch mode. Dispatch jobs across a thread pool as results stream in.
427427 thread:: scope ( |scope| {
428428 // Each spawned job will store its thread handle in here.
429429 let threads = config. threads ;
0 commit comments