Closed gavinwahl closed 9 years ago
See d6fcaf273ff0fb.
pipe()
calls run()
to get the first process of the pipe list. This makes this code readable IMHO, I'm not very seduced by the idea of having run()
call pipe()
.
pipe could just as easily call Subprocess. I'm not suggesting that run calls pipe, I'm say they're redundant and the public api should only have one function.
As I said, I don't want spm to be a library only for piping subprocesses. And having only pipe()
as a public API would suggest that.
Second of all, run()
has a nice interface which uses positional arguments, like this (i.e run('foo', 'bar')
) this allows things like this:
import spm
import functools
git = functools.partial(spm.run, 'git')
git('commit').wait()
Using pipe()
in order to run a simple command would remove this feature.
I think pipe()
and run()
is a nice public API. Reopen this issue if you think I'm wrong.
Thanks.
It seems to me that run and pipe are redundant. Running a single command is a special case of a pipeline. I think an interface like this would make sense:
Replace
run('ls', '-l')
withpipe(['ls', '-l'])
Replace
pipe([['ls', '-l'], ['grep', 'foo']])
withpipe(['ls', '-l'], ['grep'], ['foo']])