On Fri, 2007-09-14 at 12:36 +0200, Tommaso Cucinotta wrote:
> Waiting for the process to die would only work for simple apps
> like "gv". For example, the default behaviour of acroread is,
> on Linux, to open a new window and wait if it is not running,
> or to display the requested document into the already running
> window, if it is already running, and *exit immediately*.

Here's another way to keep track of open files:

lsof ~/tmp/lyx_tmpdir3909cEWtW6/lyx_tmpbuf0/thesis.*

COMMAND    PID     USER   FD   TYPE DEVICE      SIZE    NODE NAME
kghostvie 4428 dfreeman   13r   REG    9,0 107171924
3004525 /home/dfreeman/tmp/lyx_tmpdir3909cEWtW6/lyx_tmpbuf0/thesis.ps
gs        4838 dfreeman   13r   REG    9,0 107171924
3004525 /home/dfreeman/tmp/lyx_tmpdir3909cEWtW6/lyx_tmpbuf0/thesis.ps
gs        4839 dfreeman   13r   REG    9,0 107171924
3004525 /home/dfreeman/tmp/lyx_tmpdir3909cEWtW6/lyx_tmpbuf0/thesis.ps
kpdf      5039 dfreeman   13r   REG    9,0   6475882
3004856 /home/dfreeman/tmp/lyx_tmpdir3909cEWtW6/lyx_tmpbuf0/thesis.pdf

So kghostview keeps it in use, kpdf does too. But kdvi doesn't, of
course :)

To test for kghostview and kpdf, then, call `lsof filename` and if it
returns an empty string it's not being viewed anymore. Maybe this can be
one more attribute of the viewer configurations - method of checking if
it is still in use. One could then use custom shell scripts for more
complex tests.

Have fun,
Darren

Reply via email to