amitt001 / delegator.py

Subprocesses for Humans 2.0.
MIT License
1.7k stars 92 forks source link

Documentation incorrectly suggests that you can pass a list of args for something you want to run #77

Open flyingsymbols opened 4 years ago

flyingsymbols commented 4 years ago

Because of the "shell": True argument below, passing in a list will not work as expected, which I had to find out the hard way

@property
def _default_popen_kwargs(self):
    return {
        "env": os.environ.copy(),
        "stdin": subprocess.PIPE,
        "stdout": subprocess.PIPE,
        "stderr": subprocess.PIPE,
        "shell": True,
        "universal_newlines": True,
        "bufsize": 0,
    }
danieldjewell commented 1 year ago

This is true. I tried running

delegator.run(['make', 'clean'])

and got a very different result than what I was expecting! The current setup requires running:

 delegator.run(['make clean'])