-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
On macro run error: show status, stdout and stderr #4614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b21d840
to
79b06e3
Compare
Somehow I don't like the "---- Got on stdout: ----" lines, they seem to have a different look and feel to the rest of the compiler error output. I get that that's a wishy-washy complaint but it feels wrong. |
@RX14 I agree completely, but I don't have any idea how this could be presented. |
Maybe indent the stream output?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe indent. Otherwise 👌
Thanks a lot for your approvals ;) |
01beb9b
to
70b21d2
Compare
Following @straight-shoota suggestion, it now looks like:
|
@bew |
@RX14 How should I go about this? I couldn't get |
@bew In this case you'll probably have to manually insert the "reset" escape code ( |
70b21d2
to
13a94f5
Compare
Rebased. Thanks @RX14 for the tip. Even if I don't like hardcoding the terminal escape code, and kind of bypassing the Colorize module, it has the merit to work! |
if result.stdout.empty? && result.stderr.empty? | ||
message << "\nGot no output." | ||
else | ||
message << "\e[0m" if Colorize.enabled? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a Colorize#reset
method would be interesting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would do it, yes, should I open another PR for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind squashing your commits then add another one that implements Colorize#reset
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ysbaddaden how would it be used?
message << Colorize.reset
message << "".colorize.reset
# --> does it make sense to have: "abc".colorize.reset ?
Colorize.reset(message)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I believe "abc".colorize.reset
makes sense: we want to print a string and make sure the ASCII escape codes have been reset.
Thought this is about disabling escape codes, it's still adding escape codes to the string, so we should follow the actual API (as .bold
, ...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for "abc".colorize.reset
, should I save the current formatting, reset, put "abc"
, then restore the formatting? Or should I go simple for this PR, and just reset and put the text?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think that Colorize.reset
is a better API. Using String#colorize
implies you want to do something to a string, and most importantly that whatever changes you made will be reset afterwards. With String#colorize.reset
you don't get that, there's no way to restore the old colours at the end of the string, so I don't think that API makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
13a94f5
to
500e9fc
Compare
So I rebased, squashed, and added |
Perhaps the |
500e9fc
to
a7776b9
Compare
@RX14 done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just discovered I missed something, what do I do? new PR with the fix?
message.puts | ||
result.stderr.each_line do |line| | ||
message << " " | ||
message << line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed the \n
message.puts | ||
result.stdout.each_line do |line| | ||
message << " " | ||
message << line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed the \n
First PR to display more information about a failing macro run.
Another PR might come to display the errors without the backtrace from
ecr/processor
to properly resolve #4577Given thoses files:
Compilation will give:
If you have any other ideas how to present stdout & stderr, I'm open to suggestion.
There is currently no specs on the macro method
run
, should I try to make one for this?