Skip to content

Commit 7dca2e8

Browse files
committed
add many checks
1 parent 79373b9 commit 7dca2e8

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/fpm_meta.f90

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,12 +736,18 @@ subroutine find_command_location(command,path,echo,verbose,error)
736736
return
737737
end if
738738

739+
print *, '+ get temp filename...'
740+
739741
tmp_file = get_temp_filename()
740742

743+
print *, '+ get temp filename... '//tmp_file
744+
741745
! On Windows, we try both commands because we may be on WSL
742746
do try=merge(1,2,get_os_type()==OS_WINDOWS),2
743747
search_command = search(try)//command
748+
print *, '+ attempt ',try,': ',search_command
744749
call run(search_command, echo=echo, exitstat=stat, verbose=verbose, redirect=tmp_file)
750+
print *, 'after run, stat=',stat
745751
if (stat==0) exit
746752
end do
747753
if (stat/=0) then
@@ -755,6 +761,7 @@ subroutine find_command_location(command,path,echo,verbose,error)
755761
if (stat == 0)then
756762
do
757763
call getline(iunit, line, stat)
764+
print *, 'get line, stat=',stat
758765
if (stat /= 0) exit
759766
if (len(screen_output)>0) then
760767
screen_output = screen_output//new_line('a')//line
@@ -771,6 +778,8 @@ subroutine find_command_location(command,path,echo,verbose,error)
771778

772779
! Only use the first instance
773780
length = index(screen_output,new_line('a'))
781+
782+
print *, '+ get line length: ',length
774783
multiline: if (length>1) then
775784
fullpath = screen_output(1:length-1)
776785
else
@@ -783,6 +792,7 @@ subroutine find_command_location(command,path,echo,verbose,error)
783792

784793
! Extract path only
785794
length = index(fullpath,command,BACK=.true.)
795+
print *, 'extract fullpath, length=',length
786796
if (length<=0) then
787797
call fatal_error(error,'full path to command ('//command//') does not include command name')
788798
return
@@ -795,9 +805,13 @@ subroutine find_command_location(command,path,echo,verbose,error)
795805
if (allocated(error)) return
796806

797807
! 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
799813

800-
if (.not.is_dir(path)) then
814+
if (allocated(error) .or. .not.is_dir(path)) then
801815
call fatal_error(error,'full path ('//path//') to command ('//command//') is not a directory')
802816
return
803817
end if

0 commit comments

Comments
 (0)