[neomutt-users] printcommand fails with pdf viewer spawned by trailing ampersand?
gahr at gahr.ch
Wed Mar 17 14:07:31 CET 2021
On Mar 17 2021, 12:49 UTC, "Peter P." <peterparker at fastmail.com> wrote:
>* 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?
I interpreted the error as being that muttprint cannot produce
/tmp/muttprint.ps because %s has gone before it has time to run.
If that's not the case, please disregard :)
More information about the neomutt-users