run_tool Subroutine

public subroutine run_tool(command, argv, tokenized, echo, verbose, log_file, stat)

Run a tool by argv spawn, which is safe from several OpenMP threads. When its arguments could not be split, run the shell command instead, one at a time.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: command

Shell command

type(string_t), intent(in), allocatable :: argv(:)

Arguments for run_argv

logical, intent(in) :: tokenized

Whether argv is complete

logical, intent(in) :: echo

Echo and verbosity settings of the tool

logical, intent(in) :: verbose

Echo and verbosity settings of the tool

character(len=*), intent(in) :: log_file

Tool output log file

integer, intent(out) :: stat

Status flag


Source Code

subroutine run_tool(command, argv, tokenized, echo, verbose, log_file, stat)
    !> Shell command
    character(len=*), intent(in) :: command
    !> Arguments for run_argv
    type(string_t), allocatable, intent(in) :: argv(:)
    !> Whether argv is complete
    logical, intent(in) :: tokenized
    !> Echo and verbosity settings of the tool
    logical, intent(in) :: echo, verbose
    !> Tool output log file
    character(len=*), intent(in) :: log_file
    !> Status flag
    integer, intent(out) :: stat

    if (tokenized) then
        call run_argv(argv, echo=echo, verbose=verbose, redirect=log_file, exitstat=stat)
    else
        call run(command, echo=echo, verbose=verbose, redirect=log_file, exitstat=stat)
    end if

end subroutine run_tool