-
Notifications
You must be signed in to change notification settings - Fork 346
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
Restore oldcwd if process creation fails #5441
Conversation
src/core/opamProcess.ml
Outdated
begin try Unix.chdir oldcwd | ||
with Unix.Unix_error _ -> () end; |
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.
Looks obviously correct but couldn’t we merge both uses of Unix.chdir
using Fun.protect
starting below the first Unix.chdir
at the top of the function? This way if another reraise or uncaught exception occures it will be handled automatically
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.
Yeah, I should have avoided being lazy (the laziness is having to add Fun.protect
to OpamCompat
)
0419849
to
ad541e5
Compare
@@ -618,3 +619,4 @@ users) | |||
* `OpamStd.Option`: add `equal` function [#5374 @rjbou] | |||
* `OpamStd.Compare`: add module to flag polymorphic comparison functions in opam codebase [#5374 @kit-ty-kate @rjbou] | |||
* `OpamStd.Env.`: introduce OpamStd.Env.Name to abstract environment variable names [#5356 @dra27] | |||
* `OpamCompat`: Add `Fun.protect` [#5441 @kit-ty-kate] |
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.
❤️
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.
Hum we already had OpamStd.Fun.finally
which is the same function (way before there was a Fun
module in the stdlib :/)
It'd be best to ensure we consistently use the same function everywhere.
thanks! |
Spotted when package commands fail during switch creation - the cwd is left in the build directory for the package which on Windows then prevents the switch from being cleaned up.