Skip to content
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

Prevent fork nightmare with PAGER=batcat #2235

Merged
merged 6 commits into from Aug 12, 2022

Conversation

johnmatthiggins
Copy link
Contributor

Used rsamuelklatchko's suggested changes to fix recursive fork issue. Fixes issue #2023.

Copy link
Collaborator

@Enselic Enselic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! I added some comments.

src/pager.rs Outdated Show resolved Hide resolved
src/pager.rs Outdated Show resolved Hide resolved
src/pager.rs Outdated Show resolved Hide resolved
@Enselic Enselic changed the title Added rsamuelklatchko's changes Prevent fork nightmare with PAGER=batcat Jul 1, 2022
@johnmatthiggins
Copy link
Contributor Author

Made commits with suggested changes, ready for further review.

Copy link
Collaborator

@Enselic Enselic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Much clearer code. I proposed one possible further simplification. Can you also please add an entry to CHANGELOG.md? Like this:

## Bugfixes

- Prevent fork nightmare with `PAGER=batcat`. See #2235 (@johnmatthiggins)

When that is done I think I can set this PR as Approved!

src/pager.rs Outdated Show resolved Hide resolved
johnmatthiggins and others added 2 commits July 2, 2022 16:08
Co-authored-by: Martin Nordholts <enselic@gmail.com>
@johnmatthiggins
Copy link
Contributor Author

Added to change log and altered match expression.

I forgot to comment on this name so I figured I'd just push a commit to
take care of it.
Copy link
Collaborator

@Enselic Enselic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to comment on the arg0 name, so I pushed a commit for that. I hope you didn't mind.

This looks good to me now! Thanks a lot.

As far as I can tell our current regression tests cover this PR. For example, if we hardcode is_current_bin_pager to either true or false, tests start failing.

I didn't expect it to be, but just to make sure I ensured that startup time is not in practice affected, and it wasn't:

% hyperfine --export-markdown /dev/tty -L bat ./target/release/bat,bat-master-c8b1187 '{bat} -f --paging=always --theme="Monokai Extended" examples/simple.rs'
Command Mean [ms] Min [ms] Max [ms] Relative
./target/release/bat -f --paging=always --theme="Monokai Extended" examples/simple.rs 11.0 ± 1.1 10.1 21.2 1.00
bat-master-c8b1187 -f --paging=always --theme="Monokai Extended" examples/simple.rs 11.1 ± 1.1 10.1 21.9 1.01 ± 0.14

@Enselic
Copy link
Collaborator

Enselic commented Aug 12, 2022

About time to merge this now I think.

@Enselic Enselic merged commit 7b2e0ec into sharkdp:master Aug 12, 2022
@Enselic Enselic linked an issue Feb 15, 2023 that may be closed by this pull request
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.

PAGER=batcat turns into a fork nightmare
2 participants