Mailing List archive

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

[vdr] Re: VDR developer version 1.1.20



Klaus Schmidinger wrote:
> Oliver Endriss wrote:
> > Klaus Schmidinger wrote:
> > > Oliver Endriss wrote:
> > > > There is just one problem in 1.1.20:
> > > > The KBD remote control does not work if vdr is started from a
> > > > shell script:
> > >
> > > What I was trying to do here is to find out whether VDR is
> > > running in the background (where accessing the keyboard would
> > > make no sense - and actually _stopped_ the process, waiting for
> > > kbd access).
> > >
> > > Can somebody come up with a (different) way of finding out
> > > whether a program is running in the background?
> >
> > Hmm, why don't you use a more hard-wired approach?
> > vdr is running in the background
> > - if the -d option has been specified AND
> > - the -t option has not been specified.
> > Otherwise assume that vdr is running in the foreground.
>
> What about
>
>    vdr &
> ?

What's the problem? vdr will try to read from stdin and will block.
That's ok because other programs do it exactly the same way.

The correct way to use '&' is:
vdr < /dev/tty9 > /dev/tty9 2>&1 &

In this case, the problem is sitting in front of the computer. :-)

> > Additionally, tcgetattr() will fail if stdin has been redirected
> > to /dev/null (something like "vdr < /dev/null").
>
> I guess checking isatty(0) will take care of this.

There is no problem if tcgetattr(STDIN_FILENO, &savedTm) failes.
I just wanted to point out that this might be used as an (additional) 
indication whether vdr runs in background mode or not. 
The call will fail if you used something like "vdr < /dev/null", 
otherwise it will succeed.

Oliver


-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index