thaljef / Pinto

Curate your own repository of Perl modules
https://metacpan.org/module/Pinto::Manual
66 stars 49 forks source link

pinto launched via system() does not launch the editor when making changes #164

Closed bluefeet closed 9 years ago

bluefeet commented 10 years ago

If I do this:

pinto --root=foo pull Acme::Monkey

I get an editor to edit the commit message. If I do this:

perl -e 'system("pinto --root=foo pull Acme::Monkey")'

The default commit message is used, as if I passed the -M option. What do you suggest as a workaround, or maybe this is a bug?

It seems to me that Pinto is trying to detect non-interactive situations, but I'm used to scripts still knowing the sessions is interactive, even through perl system() calls. Maybe Pinto just needs some more smarts?

thaljef commented 10 years ago

Yes, if STDOUT is a tty then Pinto concludes the situation is interactive. Otherwise, it is non-interactive.

perl -e 'system("pinto --root=foo pull Acme::Monkey")'

That command seems to work exactly as you would expect (i.e. interactively). Perhaps it was broken in older versions. Which version of Pinto do you have?

perl -e 'system("pinto --root=foo pull Acme::Monkey")' > logfile.txt

But if that command (or some wrapper script) is redirected to a pipe or file, then it will be non-interactive. Do you still expect it to be interactive in that case?

thaljef commented 9 years ago

I'm going to close this issue because I think it behaves the way any potentially interactive Unix command would.

To avoid interactivity, just supply a commit message with the -m option. Or use -M to accept the auto-generated message.

Feel free to re-open if you disagree with my conclusions.