1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
! Process example 3: Run with many arguments, and check runtime
program run_with_args
use stdlib_system, only: process_type, run, elapsed, wait
implicit none
type(process_type) :: p
character(len=15), allocatable :: args(:)
! Define arguments for the `echo` command
allocate(args(2))
args(1) = "echo"
args(2) = "Hello, Fortran!"
! Run the command with arguments (synchronous)
p = run(args)
! Print the runtime of the process
print *, "Process runtime:", elapsed(p), "seconds."
! Clean up
deallocate(args)
end program run_with_args
|