Skip to content

Commit

Permalink
always enclose filename in quotes in execute function if it isn't alr…
Browse files Browse the repository at this point in the history
…eady

also added an extra error check if the filename is blank
  • Loading branch information
jacobwilliams committed Aug 17, 2024
1 parent d9ded3f commit cdb7d7d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/pyplot_module.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,12 @@ subroutine execute(me, pyfile, istat, python)
file = trim(pyfile) !use the user-specified name
end if

if (file == '') then
if (present(istat)) istat = -1
write(error_unit,'(A)') 'Error: filename is blank.'
return

Check warning on line 1403 in src/pyplot_module.F90

View check run for this annotation

Codecov / codecov/patch

src/pyplot_module.F90#L1401-L1403

Added lines #L1401 - L1403 were not covered by tests
end if

!open the file:
open(newunit=iunit, file=file, status='REPLACE', iostat=iostat)
if (iostat/=0) then
Expand All @@ -1423,8 +1429,8 @@ subroutine execute(me, pyfile, istat, python)
end if

!run the file using python:
if (index(file,' ')>0) then
! space in path, probably should enclose in quotes
if (file(1:1)/='"') then
! if not already in quotes, should enclose in quotes
call execute_command_line(python_//' "'//file//'"')
else
call execute_command_line(python_//' '//file)
Expand Down

0 comments on commit cdb7d7d

Please sign in to comment.