Allow captured stderr saving to file#6793
Merged
fdncred merged 4 commits intonushell:mainfrom Oct 20, 2022
Merged
Conversation
9605688 to
05d0764
Compare
Contributor
|
We talked about this yesterday in a team meeting and while I'm not sure this is the permanent direction we want to take, as far as UI/UX, it is a good stopgap to enable a feature that we currently do not have. Thanks @WindSoilder! Keep up the good work! |
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.
Description
Closes #6658
With this pr, user can do the following to redirect external commands' stdout/stderr to the same file:
Or
And no need to use
completeto collect stderr data first, usingcompleteto collect stderr data might results to high memory usage if the external command generates many messages.Why only works with -r flag
I think we need to consume these two(stdout/stderr) message as soon as possible.
And currently, if we're using
savewithout-rflag, and file have an extension, it'll try to invoketo xxxcommand, which consumes external commands stdout stream. Finally stderr stream will only be consumed when stdout is handled, which is not good.The idle way would be using two threads, one for writing stdout, one for writing stderr, then writing these message as soon as possible, like
complete,tablecommand.Why only works with External Stream
Because nu's internal commands just return values, and there is no stdout/stderr property of that value.
Tests
Make sure you've done the following:
Make sure you've run and fixed any issues with these commands:
cargo fmt --all -- --checkto check standard code formatting (cargo fmt --allapplies these changes)cargo clippy --workspace --features=extra -- -D warnings -D clippy::unwrap_used -A clippy::needless_collectto check that you're using the standard code stylecargo test --workspace --features=extrato check that all the tests passDocumentation