@@ -12,9 +12,9 @@ use image_compare::BlendInput;
1212
1313use crate :: {
1414 cli:: Cli ,
15- open_image:: { open_image, resize_as_needed, IBoft , SingleImage } ,
16- shared:: { make_groups_and_exec, CompareTask , Pairing } ,
1715 formatting:: print_fmt,
16+ open_image:: { open_image, resize_as_needed, IBoft , SingleImage } ,
17+ shared:: { get_executable, make_groups_and_exec, CompareTask , Pairing } ,
1818} ;
1919struct ImageToCompare {
2020 path : String ,
@@ -41,7 +41,7 @@ fn image_maker_loop(
4141 Ok ( image) => {
4242 let image = resize_as_needed ( image, width, height) ;
4343 tx. send ( ImageToCompare {
44- path : filename,
44+ path : filename. to_string ( ) ,
4545 image,
4646 } )
4747 . expect ( "Unable to send image to channel" ) ;
@@ -89,12 +89,12 @@ pub fn main_images(cli: Cli) {
8989 exit ( 1 ) ;
9090 }
9191
92- for arg_filename in cli. files {
92+ for arg_filename in & cli. files {
9393 if arg_filename == "-" {
9494 dash_mode = true ;
9595 } else {
9696 filename_tx
97- . send ( arg_filename)
97+ . send ( arg_filename. clone ( ) )
9898 . expect ( "Unable to send filename to channel" ) ;
9999 }
100100 }
@@ -241,14 +241,7 @@ pub fn main_images(cli: Cli) {
241241
242242 let mut pairings = Vec :: new ( ) ;
243243
244- let executable = {
245- cli. exec . as_ref ( ) . map ( |exec| {
246- let mut split = exec. split ( " " ) ;
247- let command = split. next ( ) . expect ( "Command for exec not provided" ) ;
248- let rest: Vec < & str > = split. collect ( ) ;
249- ( command, rest)
250- } )
251- } ;
244+ let executable = get_executable ( & cli) ;
252245
253246 // If we use pairs, we execute for each pair right away.
254247 while let Ok ( pair) = pair_rx. recv ( ) {
@@ -259,6 +252,7 @@ pub fn main_images(cli: Cli) {
259252 let filename1 = bundle. image_map [ pair. index1 ] . path . clone ( ) ;
260253 let filename2 = bundle. image_map [ pair. index2 ] . path . clone ( ) ;
261254 print_fmt ( & vec ! [ & filename1, & filename2] , cli. format ) ;
255+ #[ cfg( not( feature = "no-exec" ) ) ]
262256 if let Some ( ( program, args) ) = & executable {
263257 Command :: new ( program)
264258 . args ( args)
0 commit comments