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

Pietro Cerutti gahr at gahr.ch
Wed Mar 17 13:07:13 CET 2021

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
>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

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.

set print_command="muttprint ... && qpdfview /tmp/muttprint.pdf & sleep 2"

Pietro Cerutti

More information about the neomutt-users mailing list