Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
run_external_process [2026/08/20 03:38]
hermann
run_external_process [2026/08/28 03:31] (current)
hermann Sync from local documentation review
Line 3: Line 3:
 ===== Description ===== ===== 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.+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 ===== ===== Inputs =====
  
-^ Name ^ Type ^ Description ^ +^ Name  ^ Type  ^ Description ​ 
-| File Name | [[string_type|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. | +| File Name  | [[String Type]] ​ | Full path of the executable file to run. This port is compact ​— its value is typed directly rather than supplied through a connection. If no extension is given, .exe is appended automaticallyexcept when the name ends in a bare period ​or already includes a directory path, in which case nothing is appended. An executable with a different extension (for example, ​.com) must include it explicitly. Enclose the value in double quotes if it contains spaces. ​ 
-| Parameters | [[string_type|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''​. |+| 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 batch file on Windows, set File Name to cmd.exe and Parameters to "/c NAME_OF_FILE_OR_COMMAND" |
  
 ===== Optional Inputs ===== ===== Optional Inputs =====
  
-^ Name ^ Type ^ Description ^ +^ Name  ^ Type  ^ Description ​ ^ Default Value  ​
-| Wait Process Completion | [[boolean_value_type|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. | +| Wait Process Completion ​ | [[Boolean Value Type]] ​ | If true, the model waits for the external process to finish before continuing. If false, the model continues running in parallel with the launched process. This is an advanced port.  | Yes  ​
-| Seconds To Wait | [[integer_value_type|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. |+| Seconds To Wait  | [[Integer Value Type]] ​ | After launching the process, the number of seconds the model waits before continuing execution. If zero, the model waits for the process to finish entirely. This is an advanced port.  | 0  ​|
  
 ===== Outputs ===== ===== Outputs =====
  
-^ Name ^ Type ^ Description ^ +^ Name  ^ Type  ^ Description ​ 
-| Exit Code | [[integer_value_type|Integer Value Type]] | Value returned by the process, if its execution has completed. This output can be ignored. |+| Exit Code  | [[Integer Value Type]] ​ | Value returned by the process, if its execution has completed. This output can be ignored. ​ |
  
 ===== Group ===== ===== Group =====
  
-[[functor_list#control|Control]]+[[Functor List#Control ​| Control]]
  
 ===== Notes ===== ===== 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. 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 true and Seconds To Wait is zero, the model waits indefinitely for the process to finish. If Seconds To Wait is greater than zero, the model waits only that many seconds and then continues, detaching from the processwhich keeps running ​on its own. If Wait Process Completion is false, the model detaches from the process immediately after launching it.
-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, the process ​is createdwaited onand its handles ​are closed using the operating system'​s own process APIs; the process is terminated ​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 ​watches ​for the process'​s termination ​so its handles ​can still be closedand terminates it if the model itself is aborted. The process runs under the same security context as Dinamica EGO itself.
-On Windows, ​system API functions are used to create ​the process, ​wait for itclose 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 whileand ifthe model waits for it: standard output is logged as an informational message, and standard error is logged as an error message. Standard error is only shown in the log when the process execution ​reports ​an error; ​otherwiseits content is not shown.
-The process'​s standard output and standard error are shown in the message log while (and ifthe 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 notthe error output ​content is not shown.+
  
 ===== Internal Name ===== ===== Internal Name =====
  
-''​RunExternalProcess''​+RunExternalProcess