Repository navigation
Add --redirect-combine option to run-external - #8918
Merged
Merged
Conversation
pingiun
force-pushed
the
redirect-combine
branch
3 times, most recently
from
April 18, 2023 10:56
a945f99 to
4484ace
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #8918 +/- ##
==========================================
- Coverage 68.53% 68.17% -0.37%
==========================================
Files 636 636
Lines 101713 101739 +26
==========================================
- Hits 69711 69361 -350
- Misses 32002 32378 +376
|
pingiun
force-pushed
the
redirect-combine
branch
from
April 18, 2023 11:52
4484ace to
8ae953f
Compare
pingiun
force-pushed
the
redirect-combine
branch
from
April 18, 2023 12:01
8ae953f to
1d1e322
Compare
amtoine
reviewed
Apr 18, 2023
amtoine
left a comment
Member
There was a problem hiding this comment.
i've tried it the following python script
#!/usr/bin/env python
import sys
print("foo")
print("bar", file=sys.stderr)
print("baz")
sys.exit(1)and i get
> let res = (do -i { run-external --redirect-combine ./foo.py } | complete)
>
> if $res.exit_code != 0 {
> # Only print output when command has failed.
> print "The command has failed, these are the logs:"
> print $res.stdout
> }
The command has failed, these are the logs:
bar
foo
bazwhich is expected with the way python does things as i understood?
TL;DR: looks it works 👍
--redirect-combine option, i kinda liked better the --redirect-both you talked about in the discord channel 😋
and i'd like to wait for the point of view of others from the core team about
- the new dependency on
os_pipe - the rest of the implementation
😌
thanks @pingiun for these first effort 👌 😋
Contributor
Author
|
Btw the python file printing in that order is due to buffering of the stdout. It can be remedied by adjusting it as follows: #!/usr/bin/env python
import sys
print("foo")
sys.stdout.flush()
print("bar", file=sys.stderr)
print("baz")
sys.exit(1) |
Member
|
@pingiun absolutely, nice 👌 |
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
Add option that combines both output streams to the
run-externalcommand.This allows you to do something like this:
User-Facing Changes
No breaking changes, just an extra option.
Tests + Formatting
Added a test that checks the new option
After Submitting