You are here: Start » Function Reference » All Functions » Process » FisFilter_Execute
This is Filter Equivalent. This function may be present in generated code, but should not be used in hand-written code.
Header: | STD.h |
---|---|
Namespace: | fis |
Module: | FoundationLite |
Executes a command using the system console.
Syntax
void fis::FisFilter_Execute ( const ftl::File& inCommand, const ftl::Directory& inWorkingDirectory, int& outReturnCode, ftl::String& outResult )
Parameters
Name | Type | Default | Description | |
---|---|---|---|---|
![]() |
inCommand | const File& | System command to be executed. | |
![]() |
inWorkingDirectory | const Directory& | \".\" | Working directory in which the command will be executed. |
![]() |
outReturnCode | int& | Return code of the executed command. | |
![]() |
outResult | String& | Captured text data. |
Description
Filter executes a command provided in inCommand.The command will be executed in a directory provided in inWorkingDirectory. The current working directory is stored and will be restored after execution.
Output outResult contains all the captured text during the execution of command.
Usually value 0 on output outReturnCode means that command was executed correctly.
Execution of the command blocks program execution until command execution is finished.
Examples
To get list of files on the C drive working directory should be set to C:\ and command should be set to dir. On Linux command ls should be used.
Remarks
During the command execution system console may appear. It could cause loss of the focus on the HMI form.
Usage of this filter is not recommended in FIL.
Errors
If an error occurred during the process execution a value -1 will be returned on outReturnCode.
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Could not remember current working directory. |
DomainError | Provided inWorkingDirectory is incorrect or not found. Path: provided working directory |
DomainError | Provided inWorkingDirectory user provided directory is incorrect or not found. |
RuntimeError | Could not return from working directory. |