lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LYNX-DEV another -tlog problem


From: Laura Eaves
Subject: Re: LYNX-DEV another -tlog problem
Date: Tue, 20 May 1997 01:21:00 -0400 (EDT)

> Date: Mon, 19 May 1997 19:21:16 -0500 (CDT)
> From: Klaus Weide <address@hidden>
>...
> Once stderr redirection has been started, a shell spawned with '!' may or
> may not work, or work differently.  For example on sol, bash exits
> immediately, sh doesn't show a prompt, csh seems to work normally (except
> that error messages continue to go to the Lynx tracelog file).
> Just thought I'd mention it, there probably isn't a simple way around this
> that would work in all cases.  Setting $SHELL to a shell which does work
> when started with redirected stderr is one workaround.

I don't think setting SHELL would solve the problem as there
probably isn't a shell that would reset stderr to the tty if
it has already been redirected to a file.

However, when I was playing around with stderr a few weeks ago, I noticed
that copying another FILE structure to stderr then using stderr as usual
does work -- output goes to the other file, whether or not you close the
original stderr.

So, why bother "redirecting" (closing and reopening) stderr at all?
Why not do something like
        FILE SaveOriginalStderr;
        SaveOriginalStderr = *stderr;
        if ( (newstderr = fopen(logfile,"w")) != NULL )
                *stderr = *newstderr;
        ...

Then you may or may not need to restore stderr at the ! command:
        FILE sav = *stderr;
        *stderr = SaveOriginalStderr;
        /* ... do ! command ... */
        *stderr = save;
(This may not be necessary as stdio file descriptiors may not be shared with
the child process.  However, unix file descriptor 2 is dup'd for the child
process, and it should still be connected to the tty.)

Just a thought.
--le

;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]