-
Notifications
You must be signed in to change notification settings - Fork 162
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
New GAP-level variable ErrorOutput for "*errout*" #2824
New GAP-level variable ErrorOutput for "*errout*" #2824
Conversation
9645f68
to
f99f240
Compare
lib/streams.gi
Outdated
@@ -642,7 +642,7 @@ function( str ) | |||
if fid = fail then | |||
return fail; | |||
else | |||
AddSet( InputTextFileStillOpen, fid ); | |||
ADD_SET( InputTextFileStillOpen, fid ); |
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.
Why?
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.
Ha, this was needed in markus' PR. But since i'm now using "*errout*"
directly this is not necessary anymore. I'll fix this.
lib/error.g
Outdated
PRINT_CURRENT_STATEMENT("*errout*", context); | ||
PrintTo("*errout*", " called from\n"); | ||
PRINT_CURRENT_STATEMENT(ErrorOutput, context); | ||
PrintTo(ErrorOutput, " called from\n"); |
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 am feeling a bit conflicted about the name ErrorOutput
; it'll show up in tab completion easily, esp. if one is writing code that uses Error. Since it is deeply internal, I'd prefer calling it something like ERROR_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.
Good point. Will do that.
Also this is breaking HPCGAP. I'll have a look. |
34a9e7e
to
e04b261
Compare
@fingolfin Checks pass now. |
e04b261
to
f08fcb5
Compare
Codecov Report
@@ Coverage Diff @@
## master #2824 +/- ##
==========================================
+ Coverage 76.09% 76.1% +<.01%
==========================================
Files 480 480
Lines 240969 240969
==========================================
+ Hits 183375 183380 +5
+ Misses 57594 57589 -5
|
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.
|
f08fcb5
to
5912047
Compare
I have just added that "ERROR_OUTPUT" is a readwrite global from the start. If you're ok with this you can merge it like this. |
28bd1c9
to
b43200f
Compare
I would merge this but tests don't run it seems. |
We have completly overloaded Travis and AppVeyor. I recommend that we just wait till tomorrow with further merges, to let them finish of the dozen or so pending builds on each. |
b43200f
to
7e11276
Compare
@ssiccha are you still making changes to this or can i merge once tests cycled? |
Also do you mind doing a PR for |
I broke the PR yesterday, but I didn't notice since I accidentally used the wrong gap on my machine. If this round of tests pass then it can be merged. Unless I shouldn't define Yepp, I'll do the Jupyter PR. It would be nice if this got backported. |
lib/streams.gd
Outdated
@@ -1350,6 +1350,7 @@ DeclareGlobalFunction( "UnInstallCharReadHookFunc" ); | |||
DeclareGlobalFunction( "InputFromUser" ); | |||
|
|||
|
|||
|
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.
Pleas remove this change
hpcgap/lib/streams.gi
Outdated
## | ||
## Default stream for error messages. | ||
BindGlobal("ERROR_OUTPUT", "*errout*"); | ||
MakeReadWriteGlobal("ERROR_OUTPUT", "*errout*"); |
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.
This must be in the .gd file not the .gi!
Also, if you want this writeable (apparently I misunderstood you yesterday), just use ERROR_OUTPUT:=...
lib/error.g
Outdated
## | ||
## Default stream for error messages. | ||
BindGlobal("ERROR_OUTPUT", "*errout*"); | ||
MakeReadWriteGlobal("ERROR_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.
Why even both, why not just do: ERROR_OUTPUT := "*errout*";
?
@markuspf From my POV we could backport this PR to stable-4.10 |
I'm now using |
This commit introduces a new global variable ERROR_OUTPUT. As a next step one can make it possible to change the targets of the magic strings "*stdout*", "*stdin*", and "*errout*", as suggested by @fingolfin in gap-system#1815. See gap-system#2822.
Makes all functions in error.g use ERROR_OUTPUT instead of the magic string "*errout*". Then the error messages can be redirected by overwriting ERROR_OUTPUT. This should be temporary. If the target of "*errout*" itself can be changed, this can be reverted again. See gap-system#2822.
7e11276
to
7a4ede8
Compare
Since it is used in error.g and only there, that indeed seems sensible. |
@mtorpey you should be able to use this in your package manager now. :) |
It will not redirect syntax errors though since these are printed from somewhere within the kernel. |
While using libgap, I get hit by
error message, and then the whole thing bails out. Should I use functionality from this PR, and if yes, how? Or, perhaps, this is the result merging of this PR ? |
I don't think this PR should have made any difference in that area, unless there was a bug. When using libgap, are you closing the errout socket (usually 2 at the C level)? |
the code I am porting was written for GAP 4.8.0 or so. It seems that in the meantime GAP's error handling has been changed a lot. How would one do this with GAP 4.10? |
I'm not sure there is a nice way, and either way we probably shouldn't be discussing it down here. It could/should be part of libgap I imagine, |
This is a "revival" of #1815.
Changes in comparison to PR #1815
The changes to markus' PR are
"*errout*"
instead of wrapping it in an OutputTextFile(). The reason being that when usingOutputTextFile("*errout*", bool)
(with bool true or false)make testinstall
fails due to the error messages vanishing into thin air. Actually they still appear in the terminal, but before all of the "testing: ..." output. I guess this may be somehow related to Out of order printing when using OutputTextFile("*stdout*", false) #2823?be refactored by using GAP level IsOutputTextStream objects we can still define them then.
I did not do changes to
colorprompt.g
since I thinkSTDOut
is only defined in this file because there is no method installed forWriteAll
which can take"*stdout*"
as an argument. Also I have the feeling definingErrorOutput
should be a temporary solution only.