Consultor Eletrônico



Kbase P34296: How to get the exit code from a command line program?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   01/06/2010
Status: Verified

GOAL:

How to get the exit code from a command line program?

GOAL:

How to retrieve the process exit status in the ABL?

FACT(s) (Environment):

Progress 9.x
OpenEdge 10.x
All Supported Operating Systems

FIX:

When using the INPUT THROUGH, OUTPUT THROUGH or OS-COMMAND statements, it is not possible to retrieve directly the exit code from the command in the ABL.
As a workaround, it is possible to enclose the command to run in a batch script which records the exit code and then prints it to the screen (for INPUT THROUGH) or save it to a file (for OUTPUT THROUGH or OS-COMMAND) which can be read later.
Retrieving the exit code on Windows
Create a .bat or .cmd script, which runs the command and then records the ERRORLEVEL variable.
Retrieving the exit code on Unix
Create a shell script, which runs the command and then records the special shell variable $?