ocaml / opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
https://opam.ocaml.org
Other
1.21k stars 348 forks source link

`opam pin add --edit --yes` pauses before launching the editor #6038

Open shym opened 2 weeks ago

shym commented 2 weeks ago

opam pin add --edit pauses before launching the editor even when given --yes and setting OPAMEDITOR. I would have expected --yes (and --no) to make opam switch to non-interactive mode (maybe it would make more sense to have a dedicated option to set the non-interactive mode, namely picking the default choice, not always yes or no).

Getting a “Press enter to start ...” message before opening an editor in an --edit command made me look again at what git does before opening an editor: it just displays “hint: Waiting for your editor to close the file...” in case something goes wrong there but doesn’t pause (and clears the message as soon as the editor finishes). But maybe we can safely assume git users have an editor configured, opam users less so.

I did get the behaviour I was looking for by running opam pin ... < /dev/null as, in my case, the chosen OPAMEDITOR is not interactive.

(I’m running version 2.1.6 but I think that part of the code didn’t change in master.)