Back to Aurora Vision Studio website

You are here: Start » Filter Reference » System » Process » Execute_WaitForExit

Execute_WaitForExit


Module: FoundationLite

Executes a system command, captures output and waits for completion.

Name Type Description
Input value inCommand File System command to be executed.
Input value inArguments StringArray Arguments for the command.
Input value inWorkingDirectory Directory Working directory in which the command will be executed.
Input value inEncoding String Expected encoding of command output.
Output value outReturnCode Integer Return code of the executed command.
Output value outResult String Captured text data.
Output value outRawResult ByteBuffer Captured raw bytes.

Description

Filter executes a command provided in inCommand with inArguments arguments. The command will be executed in a directory provided in inWorkingDirectory.

Output outResult contains text captured during execution of the command.

Usually value 0 on output outReturnCode means that command was executed correctly.

Program execution is blocked until command execution is finished.

inEncoding input determines which encoding will be used for reading output text:

  • UTF8 - UTF8
  • UTF16 - UTF16, little endian
  • OEM - current DOS code page (for example 850)
  • ANSI - current Windows code page (for example 1252)
  • CP + number - specific code page, for example CP1250
  • RAW - skips text conversion, outResult will be empty. User can provide their own conversion using outRawResult.

Note that code pages are supported on Windows only.

Examples

Description of usage of this filter can be found in examples and tutorial: Starting Notepad with Execute filter, Turning computer off using Execute.

How to get name of the current user:

  • Set inCommand to C:\Windows\System32\cmd.exe.
  • Add argument /c whoami to inArguments.
  • User name will be provided on outResult output.

Example below shows how to shut down computer at desired time using Execute_WaitForExit filter.

Remarks

Usage of this filter is not recommended in AVL.

On Windows both standard output and standard error streams are redirected. On Linux only standard output is redirected.

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

If an error occurred during the process execution a value -1 will be returned on outReturnCode.

List of possible exceptions:

Error type Description
DomainError Encoding not supported on Linux: provided encoding

Complexity Level

This filter is available on Advanced Complexity Level.

Disabled in Lite Edition

This filter is disabled in Lite Edition. It is available only in full, Aurora Vision Studio Professional version.

Filter Group

This filter is member of Execute filter group.