@@ -736,12 +736,18 @@ subroutine find_command_location(command,path,echo,verbose,error)
736
736
return
737
737
end if
738
738
739
+ print * , ' + get temp filename...'
740
+
739
741
tmp_file = get_temp_filename()
740
742
743
+ print * , ' + get temp filename... ' // tmp_file
744
+
741
745
! On Windows, we try both commands because we may be on WSL
742
746
do try= merge (1 ,2 ,get_os_type()==OS_WINDOWS),2
743
747
search_command = search(try)// command
748
+ print * , ' + attempt ' ,try,' : ' ,search_command
744
749
call run(search_command, echo= echo, exitstat= stat, verbose= verbose, redirect= tmp_file)
750
+ print * , ' after run, stat=' ,stat
745
751
if (stat== 0 ) exit
746
752
end do
747
753
if (stat/= 0 ) then
@@ -755,6 +761,7 @@ subroutine find_command_location(command,path,echo,verbose,error)
755
761
if (stat == 0 )then
756
762
do
757
763
call getline(iunit, line, stat)
764
+ print * , ' get line, stat=' ,stat
758
765
if (stat /= 0 ) exit
759
766
if (len (screen_output)>0 ) then
760
767
screen_output = screen_output// new_line(' a' )// line
@@ -771,6 +778,8 @@ subroutine find_command_location(command,path,echo,verbose,error)
771
778
772
779
! Only use the first instance
773
780
length = index (screen_output,new_line(' a' ))
781
+
782
+ print * , ' + get line length: ' ,length
774
783
multiline: if (length> 1 ) then
775
784
fullpath = screen_output(1 :length-1 )
776
785
else
@@ -783,6 +792,7 @@ subroutine find_command_location(command,path,echo,verbose,error)
783
792
784
793
! Extract path only
785
794
length = index (fullpath,command,BACK= .true. )
795
+ print * , ' extract fullpath, length=' ,length
786
796
if (length<= 0 ) then
787
797
call fatal_error(error,' full path to command (' // command// ' ) does not include command name' )
788
798
return
@@ -795,9 +805,13 @@ subroutine find_command_location(command,path,echo,verbose,error)
795
805
if (allocated (error)) return
796
806
797
807
! On Windows, be sure to return a path with no spaces
798
- if (get_os_type()==OS_WINDOWS) path = get_dos_path(path,error)
808
+ if (get_os_type()==OS_WINDOWS) then
809
+ print * , ' get dos path'
810
+ path = get_dos_path(path,error)
811
+ print * , ' dos path = ' ,path
812
+ end if
799
813
800
- if (.not. is_dir(path)) then
814
+ if (allocated (error) .or. .not. is_dir(path)) then
801
815
call fatal_error(error,' full path (' // path// ' ) to command (' // command// ' ) is not a directory' )
802
816
return
803
817
end if
0 commit comments