Hi,
I found tcl exec command returns string from stdout first then stderr. For example, my following "test script" generates messages in this order:
puts "test started"
puts stderr "some non-fatal error goes to stderr"
puts "test passed"
Then I execute the script like this:
set ret [ catch { exec sh -c $cmd } msg ]
and what I get from $msg is:
test started
test passed
some non-fatal error goes to stderr
and this is really making me hard to get the correct result.
Can someone let if know if it is possible to get the messages from both stdout and stderr in order, and:
1) please do not redirecting like this, which can get them all in order indeed:
set ret [ catch {exec $cmd >&log.txt} msg ]
2) I have to call that tcl script in my tcl script, sorry
3) Nor can I source the .tcl test script directly because there are other scripts called between the two and it wont work if my tcl script just source that tcl script.
I am using tclsh 8.3
Not sure if this is asking too much. I hope someone may figure this out. Thanks.