[neomutt-users] printcommand fails with pdf viewer spawned by trailing ampersand?

Peter P. peterparker at fastmail.com
Wed Mar 17 13:49:07 CET 2021


* Pietro Cerutti <gahr at gahr.ch> [2021-03-17 13:07]:
> On Mar 17 2021, 11:18 UTC, "Peter P." <peterparker at fastmail.com> wrote:
> > Hi list,
> 
> Hi Peter,
> 
> > it seems that due to any upgrade my trusted printcommand stopped
> > working:
> > set print_command="muttprint -p TO_FILE:/tmp/muttprint.ps %s && ps2pdf /tmp/muttprint.ps /tmp/muttprint.pdf && rm /tmp/muttprint.ps && qpdfview /tmp/muttprint.pdf &"
> > 
> > with the following lpr error(?) being thrown
> > 	lpr: Error - The printer or class does not exist.
> > 	Error: /undefinedfilename in (/tmp/muttprint.ps)
> > 	[...]
> > unless I remove the trailing ampersand after launching qpdfview. I can't
> > seem to understand how lpr is involved here at all and why the ampersand
> > makes all the difference. I have disabled all other muttprint config
> > files on my system as far as I can tell.
> > 
> > Is there also any better way of spawning the viewer and returning command to
> > mutt?
> 
> The usual workaround is to add a tiny sleep at the tail, to give the
> pipeline time to come up before neomutt gets rid of the temporary file.
Thanks for the reply! This sounds like a race condition to me.
 
> set print_command="muttprint ... && qpdfview /tmp/muttprint.pdf & sleep 2"
In my case neomutt does not know about the existence of
/tmp/muttprint.pdf which got created by ps2pdf, so I suppose it will not
get rid of that file? 

best, P
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://mailman.neomutt.org/pipermail/neomutt-users-neomutt.org/attachments/20210317/6db093cf/attachment.sig>


More information about the neomutt-users mailing list