bug fixes, speed improvements, improve shell support#68
Merged
Conversation
`command -v` is supposted to fail silently, but on osh it prints to stderr upon failure. Redirect stderr to /dev/null so this isn't displayed. Won't affect other shells.
Add a third parameter to `read` when parsing vm_stat output. Without this `zsh` and `osh` both fail to remove the trailing `.`. This change has no affect on other shells.
- use parameter expansion rather than sed to trim "-query" - don't bother trimming "*/usr/", not needed since f2c15fa
ThatOneCalculator
requested changes
Jun 7, 2025
- replace use of sed, basename, cut with parameter expansion - remove $shell variable that was unused (if it's needed it should be outside of the Linux section) - replace expr with $((..)) - remove redundant echo and resulting subshell
mksh is limited to 32-bit integers, which causes it to overflow when calculating memory on macos and bsd. This same limitation should affect any shell running on a 32-bit system with >=4GB of memory. In order to fix this: - change order of mutliply and divide when calculating memory in use, this should work for up to 4TiB of memory (rather than 4GiB previously) - for total memory there isn't so easy a solution, so fall back to expr if we calculate we have 0 MiB of total memory
Owner
|
Thank you so much! Because there are a lot of individual changes, I will take the time to test this manually on my own machines with different configurations just to ensure that everything works as expected, so I may hold off on merging this until tomorrow or Monday – but when I do, this will likely mark 8.4.0. |
Owner
|
Reviewed in multiple setups, hitting this with a good ol' LGTM! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a bit of a catch-all. I kept each commit discrete by topic, but there are several topics covered in this PR. Each commit should apply cleanly in any order, so if you don't like all of them, feel free to mix and match. Or, if you prefer, I could resubmit them as more than one PR.
faster
hyperfine results:
fixed compatibility with zsh, osh, mksh
before:
after: