Considering that I think I wrote that code I should probably comment. I played around with this and I couldn’t find an elegant way of redirecting both stderr and stdout to the process log as well as detecting the exit code of the command for error handling. Cloverleaf does funny things with the stdout and stderr file channels when you’re running in an hciengine process. The easiest way to handle this might be to redirect output to a file.
Code:
set errCode [catch {exec sh -c “$cmd > $tempfile 2>&1″} errMsg]
puts -nonewline [read_file $tempfile]
Hi Jeff and David. If it were me, I would not try to use stdout and stderr within the engine. Instead, I would do as David suggested and redirect output to a file.
You could use perl to do inline find and replace and change your redirects to ” > /dev/null” perhaps? Or to a real log file?
I think the issue is that you want to be able to review the output of the command when it fails, so sending it to /dev/null wouldn’t be a good idea. A real log file would be better, but then you have to come up with a strategy for archiving the log files.
Author
Replies
Viewing 2 reply threads
The forum ‘Cloverleaf’ is closed to new topics and replies.