postmodern / ruby-install

Installs Ruby, JRuby, TruffleRuby, or mruby
MIT License
1.91k stars 255 forks source link

Give information when running sudo #374

Closed bloerwald closed 1 year ago

bloerwald commented 4 years ago

I think it would also be a good idea to warn about what is suddenly sudo'd. I ran into an unexpected password prompt due to #338, which is surely not something I would have expected while not doing a --system install.

I'd suggest

function nice_sudo() 
{
  echo "Running 'sudo ${@}'!"
  sudo "${@}"
}
if (( UID == 0 )); then sudo=""
else                    sudo="nice_sudo"
fi

for sake of user experience and transparency.

postmodern commented 4 years ago

It might be useful to output as debugging messages enabled by a --debug option. ruby-install by default doesn't print the commands it's running, just descriptive messages, so a giant sudo command in the output might be surprising to users.

postmodern commented 1 year ago

The 0.9.0 branch now has a -D,--debug option that will output any sudo commands. fb4779c