@@ -631,7 +631,13 @@ impl Update {
631
631
let updater_type = self . extract ( bytes) ?;
632
632
633
633
let install_mode = self . config . install_mode ( ) ;
634
- let current_args = & self . current_exe_args ( ) [ 1 ..] ;
634
+ let current_exe_args = self . current_exe_args ( ) ;
635
+ let current_args =
636
+ current_exe_args
637
+ . split_first ( )
638
+ . map ( |( _, args_without_exe) | args_without_exe)
639
+ . unwrap_or ( & [ ] ) ;
640
+
635
641
let msi_args;
636
642
637
643
let installer_args: Vec < & OsStr > = match & updater_type {
@@ -640,25 +646,35 @@ impl Update {
640
646
. iter ( )
641
647
. map ( OsStr :: new)
642
648
. chain ( once ( OsStr :: new ( "/UPDATE" ) ) )
643
- . chain ( once ( OsStr :: new ( "/ARGS" ) ) )
644
- . chain ( current_args. to_vec ( ) )
649
+ . chain (
650
+ if current_args. len ( ) > 0 {
651
+ Some ( once ( OsStr :: new ( "/ARGS" ) ) . chain ( current_args. iter ( ) . map ( |arg| * arg) ) )
652
+ } else {
653
+ None
654
+ } . into_iter ( ) . flatten ( )
655
+ )
645
656
. chain ( self . installer_args ( ) )
646
657
. collect ( ) ,
647
658
WindowsUpdaterType :: Msi { path, .. } => {
648
- let escaped_args = current_args
649
- . iter ( )
650
- . map ( escape_msi_property_arg)
651
- . collect :: < Vec < _ > > ( )
652
- . join ( " " ) ;
653
- msi_args = OsString :: from ( format ! ( "LAUNCHAPPARGS=\" {escaped_args}\" " ) ) ;
659
+ if current_args. len ( ) > 0 {
660
+ let escaped_args = current_args
661
+ . iter ( )
662
+ . map ( escape_msi_property_arg)
663
+ . collect :: < Vec < _ > > ( )
664
+ . join ( " " ) ;
665
+ msi_args = Some ( OsString :: from ( format ! ( "LAUNCHAPPARGS=\" {escaped_args}\" " ) ) ) ;
666
+ }
667
+ else {
668
+ msi_args = None ;
669
+ }
654
670
655
671
[ OsStr :: new ( "/i" ) , path. as_os_str ( ) ]
656
672
. into_iter ( )
657
673
. chain ( install_mode. msiexec_args ( ) . iter ( ) . map ( OsStr :: new) )
658
674
. chain ( once ( OsStr :: new ( "/promptrestart" ) ) )
659
675
. chain ( self . installer_args ( ) )
660
676
. chain ( once ( OsStr :: new ( "AUTOLAUNCHAPP=True" ) ) )
661
- . chain ( once ( msi_args. as_os_str ( ) ) )
677
+ . chain ( msi_args. iter ( ) . map ( |args| args . as_os_str ( ) ) )
662
678
. collect ( )
663
679
}
664
680
} ;
0 commit comments