tags:

views:

28

answers:

1

I'm trying to execute some program:

exec -ignorestderr "bin/tecs-software-suite-2.5/JackCompiler.bat" "$current_file"

the program writes to the stderr, so tcl shows an error dialog similar to it's ordinary errors. I don't want that, I simply want it's error output(all it's output) to be in a TK label. I added an ignorestderr but it doesnt work. (I work with activetcl 8.5.8, Windows 7)

Thanks

+1  A: 

The magic you are looking for is 2>@1, used like this:

# Split this up for readability...
set compiler "bin/tecs-software-suite-2.5/JackCompiler.bat"
set s [exec $compiler $current_file 2>@1]

Note that if the compiler program exits with a non-zero exit code, you'll still get an error.

Donal Fellows
Sorry, but it didn't work for me. it's still showing an error message as long as the compiler write to stderr.Please Help, Don't know what to do...
Popper
If the compiler is writing to somewhere else (e.g., directly to the terminal!) then you've got problems. The biggest of these problems is that you're on Windows and so can only use a half-assed version of Expect (terminal automation is an area where Unix is *much* better than Windows).
Donal Fellows
On the other hand, I tested carefully (on Unix – OSX to be exact - using ActiveTcl 8.5.2.0.284846) with a script that just wrote to stderr and exited successfully. Without `2>@1` it would give an error, and with it it would capture that output and return it correctly. Whatever is going on is either a Windows-specific problem (about which I can do little to even test) or something else going on which you've not revealed.
Donal Fellows