feat: add convenience cmd line option to set up xtrace#915
Merged
Conversation
Test Results 3 files 29 suites 14m 17s ⏱️ Results for commit d40f98d. |
Public API changes for crate: brush-coreAdded itemsPublic API changes for crate: brush-interactiveAdded itemsPublic API changes for crate: brush-shellAdded itemsPerformance Benchmark Report
Code Coverage Report: Only Changed Files listed
Minimum allowed coverage is Test Summary: bash-completion test suite
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a --xtrace-file command-line option that provides a convenient way to enable execution tracing (set -x) and redirect the trace output to a specified file. This automates three manual steps: opening a file for the trace output, assigning it to a file descriptor, and setting the BASH_XTRACEFD variable to point to that descriptor—all before any initialization or rc scripts execute.
Key changes:
- New command-line option
--xtrace-file FILEthat enables xtrace and directs output to the specified file - New
OpenFiles::add()method that automatically finds and assigns the next available file descriptor - New error types for handling file creation failures and file descriptor exhaustion
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| brush-shell/src/args.rs | Adds --xtrace-file command-line argument definition under UI options |
| brush-shell/src/entry.rs | Implements enable_xtrace_to_file() function that opens the file, adds it to the FD table, and configures xtrace |
| brush-interactive/src/error.rs | Adds FailedToCreateXtraceFile error variant for file creation failures |
| brush-core/src/openfiles.rs | Implements add() method to automatically assign file descriptors, with constants for FD range limits (3-1024) |
| brush-core/src/error.rs | Adds TooManyOpenFiles error kind for when all file descriptors are exhausted |
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 adds a command-line option
--xtrace-filetobrushthat automates setting upset -xstyle tracing to an output file, including:BASH_XTRACEFDto the file descriptor (before any init/rc scripts run in the shell)