Skip to content

scripts: allow list input to run.command #928

@maxpietsch

Description

@maxpietsch

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']])

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions