| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! Check that we accept all variants of the EXECUTE_COMMAND_LINE intrinsic. |
| 4 |
! |
| 5 |
integer :: i, j |
| 6 |
character(len=100) :: s |
| 7 |
|
| 8 |
s = "" |
| 9 |
|
| 10 |
call execute_command_line ("ls *.f90") |
| 11 |
|
| 12 |
print *, "-----------------------------" |
| 13 |
|
| 14 |
call execute_command_line ("sleep 1 ; ls *.f90", .false.) |
| 15 |
print *, "I'm not waiting" |
| 16 |
call sleep(2) |
| 17 |
|
| 18 |
print *, "-----------------------------" |
| 19 |
|
| 20 |
call execute_command_line ("sleep 1 ; ls *.f90", .true.) |
| 21 |
print *, "I did wait" |
| 22 |
call sleep(2) |
| 23 |
|
| 24 |
print *, "-----------------------------" |
| 25 |
|
| 26 |
call execute_command_line ("ls *.f90", .true., i) |
| 27 |
print *, "Exist status was: ", i |
| 28 |
|
| 29 |
print *, "-----------------------------" |
| 30 |
|
| 31 |
call execute_command_line ("ls *.doesnotexist", .true., i) |
| 32 |
print *, "Exist status was: ", i |
| 33 |
|
| 34 |
print *, "-----------------------------" |
| 35 |
|
| 36 |
call execute_command_line ("echo foo", .true., i, j) |
| 37 |
print *, "Exist status was: ", i |
| 38 |
print *, "Command status was: ", j |
| 39 |
|
| 40 |
print *, "-----------------------------" |
| 41 |
|
| 42 |
call execute_command_line ("echo foo", .true., i, j, s) |
| 43 |
print *, "Exist status was: ", i |
| 44 |
print *, "Command status was: ", j |
| 45 |
print *, "Error message is: ", trim(s) |
| 46 |
|
| 47 |
print *, "-----------------------------" |
| 48 |
|
| 49 |
call execute_command_line ("ls *.doesnotexist", .true., i, j, s) |
| 50 |
print *, "Exist status was: ", i |
| 51 |
print *, "Command status was: ", j |
| 52 |
print *, "Error message is: ", trim(s) |
| 53 |
|
| 54 |
print *, "-----------------------------" |
| 55 |
|
| 56 |
call execute_command_line ("sleep 20", .false.) |
| 57 |
print *, "Please kill me with ^C" |
| 58 |
call sleep (10) |
| 59 |
|
| 60 |
end |