redirecting stderr/stdout AFTER a program has been started
Mike Reinehr
cmr
Thu Oct 20 10:01:17 PDT 2005
On Thursday 20 October 2005 10:24 am, Roger Oberholtzer wrote:
> On Thu, 2005-10-20 at 15:38, Man-wai Chang wrote:
> > Can it be done?
>
> I doubt it. Unless the program is written to intercept, say, a signal,
> that somehow communicates to it that the change is wanted. The main
> problem is that some I/O to the file is buffered in the program.
> Changing this without the program's knowledge would surely lead to
> corruption. Hence, a signal that lets the program know this and be a
> part of the change would be needed.
>
I'm really sticking my neck out, here, as I really don't know what I'm
talking about, but I don't think this is correct. In fact, I don't think the
program knows or cares where the output is directed. The program just is
writing to the standard output & the standard error channels. It's the o/s
that is directing the output to a terminal, file, pipe, etc.
Now, whether the o/s can be instructed to redirect the output once the
program is up & running, I don't know, but if it can be done, it should be
documented in `man bash`.
cmr
--
Debian 'Sarge': Registered Linux User #241964
"More laws, less justice." -- Marcus Tullius Ciceroca, 42 BC
More information about the Linux-users
mailing list