Repository navigation
Conversation
Runs a command with modified buffering for its standard streams. Options are -i, -o and -e, each taking L for line buffering, 0 for unbuffered, or a byte count with an optional k/m/g suffix. The modes are collected and validated but not applied, and that gap is stated rather than hidden: applying them means preloading a compiled shared library that overrides setvbuf in the child, and building that library at run time is not something this port does. The command still runs, with its default buffering, which is the same tradeoff nice makes for niceness. Exit codes are GNU's and were measured: 125 for anything stdbuf itself could not do, 127 for a command that could not be found, and the command's own status otherwise. This also lands common.die and common.fail_with_help in common.v, because the exit status differs by failure kind and the existing common.exit_with_error_message always exited 1. Those two helpers were introduced by the nix-utils branch, which now only needs to drop its copy.
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.
stdbufruns a command with modified buffering for its standard streams. Options are-i,-oand-e, each takingLfor line buffering,0for unbuffered, or a byte count with an optionalk/m/gsuffix.The modes are collected and validated but not applied, and that gap is stated rather than hidden: applying them means preloading a compiled shared library that overrides
setvbufin the child, and building that library at run time is not something this port does. The command still runs, with its default buffering — the same tradeoffnicemakes for niceness.Exit codes are GNU's and were measured: 125 for anything
stdbufitself could not do, 127 for a command that could not be found, and the command's own status otherwise.This also lands
common.dieandcommon.fail_with_helpincommon.common.v, because the exit status differs by failure kind and the existingcommon.exit_with_error_messagealways exited 1. Those two helpers were introduced by the nix-utils PR, which now only needs to drop its copy — moving them here first keeps this PR from depending on that one.Verification comes in two parts, and the second is the reason this is safe to merge. Nine unit tests pin the option parsing. But
common.common.vis imported by 143 files, so before committing I cross-compiled 29 tools that import it (26 across the main tree plus 3 more), and all 29 build. The diff to that file is 22 insertions and 0 deletions, so it is purely additive — no existing behaviour changes.