cmdstat wrong and no cmdmsg from execute_command_line
harperjf opened this issue · comments
harperjf commented
This program calls execute_command_line twice, the first time with a valid Linux command ('whoami') and the second time with a nonexistent one ('FOOBAR')
The first time it should give cmdstat the value 0 and print the user's name and nothing else.
The second time it should give cmdstat a positive value and print cmdmsg.
The program and its lfortran and ifx outputs:
program executecommands4
implicit none
call executemycommand('whoami')
call executemycommand('FOOBAR')
contains
subroutine executemycommand(cmd)
character(*),intent(in):: cmd
integer cs
character(200):: cmsg
call execute_command_line(trim(cmd),cmdstat=cs,cmdmsg=cmsg)
if(cs/=0) write(*,"(A,I0)") '*** After execute_command_line('//&
trim(cmd)//'), cmdstat=',cs,'*** Message was '//trim(cmsg)
end subroutine executemycommand
end program executecommands4
(lf2) john:~/Test/Glist$ lfortran executecommands4.f90
john
*** After execute_command_line(whoami), cmdstat=1
*** Message was
sh: 1: FOOBAR: not found
*** After execute_command_line(FOOBAR), cmdstat=1
*** Message was
The ifx output:
john
sh: 1: FOOBAR: not found
*** After execute_command_line(FOOBAR), cmdstat=124
*** Message was Invalid command supplied to EXECUTE_COMMAND_LINE