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

Rework lessopen implementation to use execute crate instead of run_script #2805

Merged
merged 5 commits into from
Jan 6, 2025

Conversation

Anomalocaridid
Copy link
Contributor

@Anomalocaridid Anomalocaridid commented Dec 16, 2023

I replaced the lessopen implementation to use a crate called execute instead of the currently-used run_script. This has the benefit of simplifying the code a little, but more importantly fixes a few weird issues I noticed.

The issues I noticed that these changes fix are:

  • batpipe not working right when using fish as a shell. Currently, bat shows the commands that batpipe prints to configure $LESSOPEN when you evaluate it in your startup config rather than the preprocessed file output.
  • bat not showing any output at all when using glow to preprocess markdown files.

Edit: Also appears to fix some known issues with lessopen-related integration tests.

@Anomalocaridid Anomalocaridid marked this pull request as draft December 17, 2023 19:33
@Anomalocaridid
Copy link
Contributor Author

Anomalocaridid commented Dec 17, 2023

Marking as draft because I realized my changes cause some of the integration tests to fail. Sorry for not catching it sooner.

@Anomalocaridid Anomalocaridid marked this pull request as ready for review December 18, 2023 04:12
@Anomalocaridid
Copy link
Contributor Author

Anomalocaridid commented Dec 18, 2023

I fixed the issues with the integration tests.

However, while troubleshooting them, I came across another potential concern that I am unsure how to resolve. I noticed that unlike what I assumed in my initial implementation, less does not appear to send $LESSCLOSE's output to stdout. If I change this to match less's behavior, then that would break the integration tests that test $LESSCLOSE because they rely on bat outputting $LESSCLOSE's output. I am not sure how to change them to work around this, though.

Also, it may be worth seeing at some point if using execute instead of run_script also fixed the issue with the randomly failing integration test.

Edit: Already investigated, see below.

@Anomalocaridid Anomalocaridid changed the title Refactor lessopen to use execute crate instead of run_script Rework lessopen implementation to use execute crate instead of run_script Dec 18, 2023
@Anomalocaridid Anomalocaridid force-pushed the refactor-lessopen branch 2 times, most recently from 7ce06c5 to 1a1c4c3 Compare April 13, 2024 22:25
@Anomalocaridid Anomalocaridid force-pushed the refactor-lessopen branch 2 times, most recently from 4c3c86d to 4355654 Compare October 31, 2024 19:31
@Anomalocaridid Anomalocaridid force-pushed the refactor-lessopen branch 4 times, most recently from df1c0d4 to a163674 Compare November 28, 2024 17:30
@Anomalocaridid
Copy link
Contributor Author

After some testing, as far as I can tell, the #[serial] attribute on some of the lessopen-related tests is not needed anymore. In addition, the one lessopen-related tests that was ignored because it randomly fails appears to work reliably.

Also while I was at it, I disabled the long-help and short-help tests for lessopen in order to address #2706.

Copy link
Collaborator

@keith-hall keith-hall left a comment

Choose a reason for hiding this comment

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

Thanks!

@keith-hall keith-hall enabled auto-merge January 5, 2025 21:13
auto-merge was automatically disabled January 5, 2025 21:36

Head branch was pushed to by a user without write access

@Anomalocaridid
Copy link
Contributor Author

My bad, I saw it said auto-merge was enabled and it would be merged when it meets the requirements and I saw the thing saying my PR branch was behind on changes from master and I assumed that being up to date was one of the requirements.

This was referenced Jan 16, 2025
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