Forget rewriting all the CLI commands in rust, let's rewrite them in -...
Forget rewriting all the CLI commands in rust, let's rewrite them in #python
- partially done from a quick search of pypi
- would make bandit happy (bandit hates subprocess)
- screaming, blazing, lightspeed fast*
* compared to *pure *bash
Self-replies
Oh wait, hold on. This is cheating. This is not how you rewrite sudo in python.
```
def run_as_sudo(sudo_user, cmd_str, shell=False, timeout=None):
sudo_args = ["sudo", "-u", sudo_user]
r = run_cmd(sudo_args + cmd_str.split(), shell=shell, timeout=timeout)
return r
```
https://github.com/wesinator/python-sudo/blob/master/sudo/sudo.py#L6