-
Notifications
You must be signed in to change notification settings - Fork 347
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 behaviour of menu and depexts in non-interactive environments #5295
Conversation
and check_again t sys_packages = | ||
let needed, _notfound = OpamSysInteract.packages_status sys_packages in | ||
let needed, _notfound = OpamSysInteract.packages_status ~env sys_packages in |
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 one was well hidden, but at least one test caught it. Maybe the parameter shouldn't have been optional 😬
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.
Totally agree! Optional parameters should be avoided as much as possible IMO.
let installed = OpamSysPkg.Set.diff sys_packages needed in | ||
let t, sys_packages = | ||
map_sysmap (fun sysp -> OpamSysPkg.Set.diff sysp installed) t, needed | ||
in | ||
if OpamSysPkg.Set.is_empty sys_packages then t else | ||
(OpamConsole.error "These packages are still missing: %s\n" | ||
(syspkgs_to_string sys_packages); | ||
entry_point t sys_packages) | ||
if OpamStd.Sys.tty_in then entry_point t sys_packages | ||
else give_up ()) |
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.
Always avoid looping if we don't read from a tty
As mentionned in private, this is more restrictive when running non-interactively but better reflects what I had in mind when adding the menu. I am open to discussion if it has some unwanted effects though, esp. since different workarounds have been proposed in the meantime. |
Since this is a different approach to the same purpose, reverts: * ocaml#5156: bf37147 * ocaml#5257: d12f951 796b0bd 3681507
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!
The new mechanism is good for me! clearer and more local |
The rationale is now to assume the "no" case in the menus whenever there is no input to read from.