Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
When I run a command like:
local $value = `fake_program_name`
I get nothing back in $value, $main::sh_status is set to 0. $sh_status is empty. $main::ERROR is empty. Is there any way to actually check to see an error?
(fake_program_name doesn't exist, which seems like a way to generate a pretty obvious error)
Hi Mike--
The problem with this is that the backtick syntax returns any text that goes to standard output in the OS, but in the case you describe (missing executable), the messages go to standard error instead.
On Windows, you can get around this by explicitly redirecting standard error to standard output as part of your command. For example, if you do this:
response(`bogus`)
you won't get any result, because Windows sends its complaints to standard error. If you include the redirection, by including "2>&1" at the end of your command, you will get the error message (assuming one is generated). For example, if you do this:
response(`bogus 2>&1`)
you will see the error message in your alert box:
--Clay