Solrac
Solrac

Reputation: 931

VISUAL DATAFLEX How can I get the exit code of Runprogram

I'm launching a DOS program using Runprogram wait "command plus args" which exits with 1 whenever an error happens and 0 when everything works as expected...

Problem is, I'm unable to catch that exit code.

I'm using VDF 18.2 my App is a desktop app.

Upvotes: 0

Views: 227

Answers (1)

Solrac
Solrac

Reputation: 931

I finally found the answer which is working like a charm. Seems to be that DataFlex has this "magic variable" called strmark which is cleaned and filled everytime I issue the command Runprogram Wait ('program') ('args').

So at the end of the day we can do something like this:

Runprogram Wait ('program.exe') ('my args')
If strmark Showln ('Well, we have an error my friend... Exit code: ' + strmark )
Else ...

This works like a charm when the program itself has a problem or even if the user closes the Command prompt window.

Upvotes: 0

Related Questions