I'd suggest allowing to support passing a list of arguments to run.command (on top of the current approach of passing a whitespace separated string that is then split to not break current scripts.). I have written an example (d4aab3d) of what I was thinking about: It bypasses the shlex splitting if the input is a list and bypasses the pipe splitting if the input is a nested list.
This would help for more complicated pipelines such as in population_template to allow lists as input to run.command where elements of that list can be changed in place - for instance depending on the result of the command. Another benefit of lists is that we don't need to rely on shlex to do the right thing (for instance with funny character encodings).
With those changes, all the commands below would be valid and equivalent:
output1 = run.command ('cat /tmp/text | cat')
output2 = run.command (['cat', '/tmp/text', '|', 'cat'])
output3 = run.command ([['cat', '/tmp/text'],['cat']])
I'd suggest allowing to support passing a list of arguments to run.command (on top of the current approach of passing a whitespace separated string that is then split to not break current scripts.). I have written an example (d4aab3d) of what I was thinking about: It bypasses the
shlexsplitting if the input is a list and bypasses the pipe splitting if the input is a nested list.This would help for more complicated pipelines such as in
population_templateto allow lists as input torun.commandwhere elements of that list can be changed in place - for instance depending on the result of the command. Another benefit of lists is that we don't need to rely on shlex to do the right thing (for instance with funny character encodings).With those changes, all the commands below would be valid and equivalent: