开发者

exec doesn't work correctly with stderr

开发者 https://www.devze.com 2023-01-06 22:17 出处:网络
I\'m trying to execute some program: exec -ignorestderr \"bin/tecs-software-suite-2.5/JackCompiler.bat\" \"$current_file\"

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 ordinar开发者_Python百科y 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消