Skip to content

Directly piping files into external commands (v2) #291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bptato
Copy link
Contributor

@bptato bptato commented Jan 12, 2024

Includes the following:

  • Stream input into mailcap entries without saving first where possible.
  • README.mailcap english translation.

This is a simpler patch than my previous attempt1. PIPE_LINK and
x-nosaveinput have been dropped. Instead, streaming is enabled for the
cases where:

  • No %s template exists in the mailcap entry, and
  • output of external viewers is ignored (or is displayed through needsterminal).

Another improvement over the previous patch: UFhalfclose is used instead
of UFclose, so that the parent process does not wait for background external
viewer processes to finish downloading.

Stuff not implemented:

  • I originally wanted to add streaming for copiousoutput/x-htmloutput; while
    this would be the "right thing" to do, it seems difficult to implement +
    pointless since w3m does not support incremental rendering anyway. So I
    decided to stick with the "download first" approach for these cases.
  • I wanted to add an environment variable that is set to the target URL
    before the entry is executed, but in the end I decided to keep the scope
    of this PR narrower and did not add it. Maybe in a future PR.

Footnotes

  1. https://github.com/tats/w3m/pull/275

Mailcap entries that

* have no copiousoutput flag and
* have no x-htmloutput flag and
* have no %s markers

are no longer saved to the file system before being piped into the
mailcap command.
@bptato
Copy link
Contributor Author

bptato commented Jan 13, 2024

Sorry, I messed up a few things; save2tmp was being called twice sometimes +
I didn't account for the HAVE_SETPGRP ifdef. Pushing a fix...

@rkta
Copy link
Contributor

rkta commented Jul 31, 2024

Another improvement over the previous patch: UFhalfclose is used instead
of UFclose, so that the parent process does not wait for background external
viewer processes to finish downloading.

I don't understand this. AFAIS the only difference between UFclose and UFhalfclose is, that the latter decides based on the scheme which close function to call. With any scheme other than SCM_FTP or SCM_NEWS/_NNTP is will call UFclose.

@bptato
Copy link
Contributor Author

bptato commented Jul 31, 2024 via email

@rkta
Copy link
Contributor

rkta commented Jul 31, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants