Run External Process

Description

RunExternalProcess runs an executable file external to Dinamica EGO, passing it the necessary parameters. It can either block the model's execution until the process finishes (or for a specified number of seconds), or launch the process and let the model continue running in parallel with it.

Inputs

Name	Type	Description
File Name	String Type	Full path of the executable file to run. This port is compact (entered directly rather than via connection). If no extension is given, .exe is appended automatically — except when the name ends in a bare . or already includes a directory path, in which case nothing is appended. An executable with a different extension (e.g. .com) must include it explicitly. Enclose the value in double quotes if it contains spaces.
Parameters	String Type	Parameters passed to the executable. May be left empty if no parameters are needed. This port is compact. To run a prompt command or a *.bat file on Windows, set File Name to cmd.exe and Parameters to /c NAME_OF_FILE_OR_COMMAND.

Optional Inputs

Name	Type	Description
Wait Process Completion	Boolean Value Type	If Yes, the model waits for the external process to finish before continuing. If No, the model continues running in parallel with the launched process. The default value is Yes. This is an advanced port.
Seconds To Wait	Integer Value Type	After launching the process, the number of seconds the model waits before continuing execution. If 0, the model waits for the process to finish entirely. The default value is 0. This is an advanced port.

Outputs

Name	Type	Description
Exit Code	Integer Value Type	Value returned by the process, if its execution has completed. This output can be ignored.

Group

Control

Notes

Executable search order

When File Name has no directory path, the executable is located by searching, in order: the current directory, Dinamica EGO's own directory, the 64-bit Windows system directory, the 32-bit Windows system directory, the 16-bit Windows system directory, and finally the Windows directory itself.

Waiting behavior

If Wait Process Completion is Yes and Seconds To Wait is 0, the model waits indefinitely for the process to finish. If Seconds To Wait is greater than 0, the model waits only that many seconds and then continues, detaching from the process (which keeps running). If Wait Process Completion is No, the model detaches from the process immediately after launching it.

Process management

On Windows, system API functions are used to create the process, wait for it, close its handles when it finishes, or terminate it if the model is aborted while it is still running. When the model does not wait for the process to finish, or the process does not finish within the specified wait time, a background thread is launched to watch for the process's termination and to close its handles, or to terminate the process if the model itself is aborted. The process runs in the same security context as Dinamica EGO itself.

Logging

The process's standard output and standard error are shown in the message log while (and if) the model waits for the process: standard output is logged as INFO, and standard error is logged as ERROR. Standard error is shown in the log only if the process execution returns an error; if it does not, the error output content is not shown.

Internal Name

RunExternalProcess