rmincUtil.checkForExternalProgram: Check the Availability of an External Program or Script

Description Usage Arguments Details Value Author(s) Examples

View source: R/rmincUtil.R

Description

Test to see whether a required program or script is installed and available on the current system. Program or script status is reflected by a returned boolean.

Usage

1
rmincUtil.checkForExternalProgram(program, test_string, prog_options="")

Arguments

program

A string specifying the program or script name. If the program/script is not expected to be on the users PATH, then the program/script name must contain a fully-qualified path.

test_string

A sub-string contained within the output of the given program/script, when executed with the provided option(s), if all is functioning properly.

prog_options

A string, usually containing a simple program/script option, which would simply test whether the program/script was found and can execute. The most obvious options would include: “-version”, and “-help”.

Details

This function is passed the name of a program or script that is s'posed to be on the user's path, along with an option that generates a known response (the test_string). If the passed test_string is not found in the returned output, we send a warning message and then return FALSE. The user, given a FALSE, can then cobble together a fitting response to the user.

Value

A boolean: TRUE if the test_string was found in the test execution, else FALSE.

Author(s)

Jim Nikelski nikelski@bic.mni.mcgill.ca

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
library(rmincIO)

program <- "xfm2param_nonexisting"
progOptions <- "-version"
test_string <- "mni_autoreg"
status <- rmincUtil.checkForExternalProgram(program, test_string, progOptions)
if ( !status ) { ... }


## End(Not run)

jnikelski/rmincIO documentation built on May 19, 2019, 2:58 p.m.