Silencing errors when casting file to program

"Tor Edvardsson @ Pike importm?te f?r mailinglistan" <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Message-ID <[email protected]>
So I'm casting a pike file to program and to make sure it compiles correctly I'm cathing any errors, like this

mixed err = catch {
  program p = (program) "some_app.pike";
};

But if it fails, it will still generate the compiling errors on stdout.  How do I stop that? 

Is this the correct solution?
http://pike.1058338.n5.nabble.com/Possible-to-override-stderr-stdin-amp-stdout-td5710030.html
It seems messy to close(), open() and then revert stdout everytime I need to cast a file to program.

So should I then as a general strategy for console based programs to dup() stdout to a seperate console object that I do output writes to and then redirect stdout to /dev/null for instance. How do you usally do it?

/ Tor Edvardsson, [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.