RunTask()

  RunTask

Description

RunTask() is used to run a specified executable.

Call Signature

int RunTask ( string task_name, string arg_string, string run_options [, function exit_function] )

Return Value

int

The process id of the task is returned or -1 if it fails to run the task. However if the run_options includes "WAIT". then it returns -1 if it fails and 1 if it succeeds.

Arguments

string task_name:

The name of the executable to run.

string arg_string:

Command-line arguments to be passed to the task.

string run_options:

Any combination of "WAIT", "SUBSHELL", SYSERROR", "QUIET" or "OWNTERM". If multiple values are passed, they must be separated by a vertical bar character "|".

  • WAIT: Task will be run syncronously and control will not return to the caller until the task is complete.
  • SYSERROR:Any errors that occur during execution of the task will be written to the SYSERROR parameter in the parameter file. WAIT must be used with this option.
  • SUBSHELL: The task_name should be run in a command process subshell.
  • QUIET: Used with EASI programs to stop the output of messages.
  • OWNTERM: Start the program in its own terminal window.

[ function exit_function ]:

If the function is not running in "WAIT" mode, then the specified function will be called when the given task completes. The execution of other functions may be temporarily interrupted while the exit_function() is executed. The exit_function is an optional argument.

Remarks

Command-line arguments can be passed, and the executable may be run in the background.

Note: Running the callback function cannot interrupt EASI while it is waiting (for example, at the command-line for user input), or while running a task using the RUN command, or while executing the Sleep() intrinsic function. In these cases, the exit function will be executed before the subsequent command is executed.

See also

KillTask()

GetPID()

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.