-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix #1994 gorge, staticExec now raise Assert on exitCode !=0; simplified implementation #10345
Conversation
timotheecour
commented
Jan 17, 2019
- fix Can't tell return value of programs with staticExec #1994
… simplified implementation
6563aaa
to
2401c56
Compare
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.
Thanks for working on this!
@@ -67,7 +67,9 @@ | |||
- two poorly documented and not used modules (`subexes`, `scgi`) were moved to | |||
graveyard (they are available as Nimble packages) | |||
|
|||
|
|||
- `gorge`, `staticExec` now raise AssertError if exitCode is not 0 instead of |
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.
Assertions aren't catchable, I think we want something that is catchable to be raised.
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.
but that's at compile time; user can always use the cleaner gorgeEx
variant which returns exitCode and handle accordingly so there's 0 loss of functionality.
In any case, catching doesn't work:
static:
try:
let a = gorge("D20190116T211842")
except OSError as e:
echo "caught"
gives:
Error: cannot evaluate at compile time: currException
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.
You should not just break the compatibility with existing code that uses the existing API. Please find a deprecation path that doesn't break existing code.
one possible solution is like in bash, it the exit code always in a special variable, but that is bad in multithreaded environments. You should rename the title of this review. With the title how it is now I wanted to close this PR without even looking at the code, because an assert would break my usages of staticExec. |
discussed in #10360
that's too error prone. Note also that this is all compile time.
a PR shouldn't be closed just because there's 1 thing you dislike about it in the title, especially when that thing can be addressed/fixed during review. If you have a concrete way to raise an exception that can be caught, please explain (after having tested it to work): as I've explained above, if I call
because of that, I'm closing this in favor of #10360 but if someone has a concrete idea (and has tested it to work!) for how to make it work, please let me know and I'll reopen this PR as it's cleaner in some ways |