Internet Explorer is no longer supported. Many things will still work, but your experience will be degraded and some things won't function. Please use a modern browser such as Edge, Chrome, or Firefox.

Exec

Modified on July 19, 2024

Executes a process, logs its output, and waits until it exits.

Script usage:

InedoCore::Exec(
	[FileName: <text>],
	[Arguments: <text>],
	[WorkingDirectory: <text>],
	[OutputLogLevel: <integer>],
	[ErrorOutputLogLevel: <integer>],
	[SuccessExitCode: <text>],
	[ImportVariables: <true/false>],
	[WarnRegex: <text>],
	[DebugRegex: <text>],
	[LogArguments: <true/false>],
	[ReportProgressRegex: <text>],
	[OutputFilterRegex: <text>]
);

Arguments:

NameFormatScript UsageUsage Notes
File name
text
FileName
Arguments
text
Arguments
Working directory
text
WorkingDirectory
Output log level
integer
OutputLogLevel
Error log level
integer
ErrorOutputLogLevel
Success exit code
text
SuccessExitCode
Integer exit code which indicates no error. The default is 0. This can also be an integer prefixed with an inequality operator. Default value is "== 0".
Import variables
true/false
ImportVariables
When set to true, all scalar execution variables currently accessible will be exported as environment variables to the process.
Warning regex
text
WarnRegex
When set to a valid regular expression string, output messages which are matched will be logged as warnings. To log only part of the message, use a group with name "m".
Debug regex
text
DebugRegex
When set to a valid regular expression string, output messages which are matched will be logged as debug. To log only part of the message, use a group with name "m".
Log arguments
true/false
LogArguments
Default value is "True".
Report progress regex
text
ReportProgressRegex
When set to a valid regular expression string, attempts to parse every output message for real-time progress updates. To capature a status message, use a group with name "m". To capture a percent complete as a number from 0 to 100, use a group with name "p".
Output filter regex
text
OutputFilterRegex
When set to a valid regular expression string, only output messages which match this expression will be logged.

Example:


# execute 7zip and only succeed if the executable returns a non-negative exit code
Exec c:\tools\7za.exe (
    Arguments: i *.*,
    SuccessExitCode: >= 0
);