Nonzero exit code when diff is not clean#9
Conversation
493ed21 to
1df4df5
Compare
ruuda
left a comment
There was a problem hiding this comment.
This works, but it is also quite invasive. What I would do instead is to keep track of something like has_changes = False in main, then make print_diff return whether there was a change, then we can do something like
has_changes |= print_diff(...)and then at the end we can check has_changes.
(Be careful with or and side effects as or short-circuits; if the left-hand side is true then it never executes the right-hand side. |= does not short-circuit.)
1df4df5 to
2d7e982
Compare
|
You're right this solution is cleaner. It required to track the changes on I needed to add a boolean variable in |
ruuda
left a comment
There was a problem hiding this comment.
This looks good! Only please make sure the file typechecks, you can typecheck it with mypy --strict.
962c84b to
5381cfe
Compare
Thanks I was not aware of this tool. I will use it in the future. |
|
Hmm something weird happened, this pull request now touches |
5381cfe to
4975a19
Compare
This is not the first time that I rebased too much and past commits are never added. I tried to reproduce what happened by adding a commit and squashing it to the previous with Thanks a lot for the fix, it worked perfectly ! |
Store diff prints to text buffer and exit program with code 2 when the diff is not empty.