0
\$\begingroup\$

In a macro file (*.do) in ALDEC Active-HDL 9.2, I am looking for a way to retrieve some kind of return value of an external executable (run by the runexe command).

So is there a way to retrieve the exit code, or to capture the console output (from stream STDOUT or even STDERR)?

Something like set return [runexe -wait -capture cmd /D /S /C exit 1]; echo $return does unfortunately not get the exit code 1, neither does set return [runexe -wait -capture cmd /D /S /C echo Result]; echo $return fetch the STDOUT output stream.

Do I miss something, or is something like that simply not supported?

If so, could such data be read from a (text) file as an alternative solution?

And by the way, is there a way to retrieve some kind of return value of a sub-macro (another *.do script run by the runscript command)?

\$\endgroup\$
4
  • \$\begingroup\$ If this is running in CMD on a windows machine (you have not told!), read up on the IF ERRORLEVEL DOS / BATCH command. \$\endgroup\$
    – Hannu
    Commented Nov 16 at 16:09
  • \$\begingroup\$ @Hannu, I'm talking about *.do macros, but not about the Windows Command Prompt. These macros run inside the Active-HDL application. \$\endgroup\$
    – aschipfl
    Commented Nov 17 at 11:12
  • \$\begingroup\$ Ah, sorry, that was stated and my eyes skipped it. In my opinion the "runexe" you're using should provide such a feature. i guess you've already checked; Is there nothing about such things in the documentation? \$\endgroup\$
    – Hannu
    Commented Nov 17 at 13:28
  • \$\begingroup\$ @Hannu, unfortunately not, I searched the documentation and the web, but without success; perhaps someone else came across that issue and found a better solution than me… \$\endgroup\$
    – aschipfl
    Commented Nov 18 at 9:13

1 Answer 1

0
\$\begingroup\$

The only work-around I found so far is to let the sub-executable write a variable definition statement to a temporary macro, like:

# write result to temporary `*.do` macro
# (`setenv` is needed instead of `set`):
runexe -wait -capture cmd /D /S /C {echo setenv var Test_1> temp.do}
# retrieve the resulting value:
runscript -do temp.do
echo $var
# clean up temporary macro:
runexe cmd /D /S /C del temp.do
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.