Redirection of standard streams
"Per Hedbor () @ Pike (-) importm?te f?r mailinglistan" <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <[email protected]> |
First: assign() only modifies what the pike object sees as it's
internal fd.
write() and werror() are however resolved when the master is compiled
to point to specific low-level fd (or, rather, they have their own
Stdio.File instances, and as such are not affected by what happens
with Stdio.std*) (well, you could always use add_constant to change
them for newly compiled code, but it will not change what they point
to for old code).
It is possible to do an actual dup() in pike 7.8 by digging around in
the internals of Stdio.File:
Stdio.File new_stdout;
#if __VERISON__ < 8.0
new_stdout = Stdio.File();
new_stdout->assign( Stdio.stdin->_fd->dup() );
#else
new_stdout = Stdio.stdout.dup();
#endif
8.0 will hopefully soon be the new stable release (and decade now..)
so backporting should not be needed.
--
Per Hedbor