pyinvoke / invoke

Pythonic task management & command execution.
http://pyinvoke.org
BSD 2-Clause "Simplified" License
4.32k stars 365 forks source link

[sudo] This small update fix so many situations ... #849

Closed albundy83 closed 2 years ago

albundy83 commented 2 years ago

Could be done with:

cmd_str = "sudo -S -p '{}' {} sh -c \"{}\"".format(prompt, user_flags, command)

But it could change the default shell to sh instead of bash

Varriount commented 2 years ago

This assumes bash is present on the system (which it might not be!).

albundy83 commented 2 years ago

Yes you are rigth but sudo command is so limited, that's a pity :(

neozenith commented 2 years ago

Would there be an issue with passing bash -c "yourcommand" or sh -c "yourcommand" as the command to the original code here?