Traditionally, when you start a program to view a document, for instance
xpdf resume.pdf
, it stays in foreground, and only returns when it
finishes, when you are done with the document. Of course you can still run it in
background if you want.
Nowadays, several programs behave in a different way, for instance Evince. When you first start it, it stays in foreground as usual. However, if you launch it a second time while the first instance it still running, it will reuse this existing instance, asking it to open your document in a new window, and immediately return. Other examples are Firefox and LibreOffice.
This behaviour is certainly more efficient in terms of memory usage and speed, but it is non-standard and causes subtle problems. When you open the attachment of an email message, or when you open a document from the Web without saving it permanently, the mailer or the browser saves the document to a temporary file, and then run a viewer with that file. As this is a temporary file, so they cannot leave it forever in /tmp; in fact they should delete it when you are done viewing it. I think the usual way to implement that is to delete it when the viewer returns: with a program that returns immediately, this means deleting it even before it has had a chance to load it.
So, if you can no longer directly open a PDF attachment from Mutt, or if you are unable to view the compressed documentation of the LaTeX class Beamer with texdoc (which uncompresses it to a temporary file and calls a PDF viewer on it), you can blame your modern PDF viewer that returns before you are finished and start hacking your mailcap file. And if you are the author of such a program, please consider implementing a way to keep a lightweight process that does not return before the main process has closed the document or to disable process reuse.
10 comments
tuesday 04 october 2011 à 06:44 Rémi Vanicat said : #1
tuesday 04 october 2011 à 09:25 mirabilos said : #2
tuesday 04 october 2011 à 10:34 Andrew Shadura said : #3
tuesday 04 october 2011 à 11:01 Matthias Urlichs said : #4
tuesday 04 october 2011 à 11:08 milosh said : #5
tuesday 04 october 2011 à 12:11 aukkras said : #6
tuesday 04 october 2011 à 12:25 Lee said : #7
tuesday 04 october 2011 à 17:33 sytoka said : #8
tuesday 04 october 2011 à 17:52 sytoka said : #9
wednesday 05 october 2011 à 08:33 Tanguy said : #10