Change `cmd` parameter in `ExecuteProcess`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 155
- Forks
- 182
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 6
Description
Feature request
Feature description
The current format of cmd is a little confusing. e.g.:
ExecuteProcess(['ls -las']) # fails
ExecuteProcess(['ls -las'], shell=True) # Ok
ExecuteProcess(['ls', '-las']) # Ok
ExecuteProcess(['ls', '-las'], shell=True) # Ok
That is maybe not of much interest, but the following case:
ExecuteProcess(['command', EnvironmentVariable('USER_ARGUMENTS')])
It's not way of specifying more than one argument in that environment variable, e.g.:
export USER_ARGUMENTS="-opt1 -opt2 -opt3"
That will make the program crash. The same problem applies for any substitution.
I don't see a possible workaround for that (without forcing shell=True).
My idea is to change the cmd type from:
cmd: Iterable[SomeSubstitutionsType]
to:
cmd: SomeSubstitutionsType
And use shlex.split after the substitutions are performed.
For backwards compatibility, we could accept both:
cmd: Union[SomeSubstitutionsType, Iterable[SomeSubstitutionsType]]
I realize about the problem while working in the launch frontend: https://github.com/ros2/launch/pull/226#discussion_r293036243.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the ExecuteProcess entry point and the discussion in ros2/launch#226, which motivated this request. Trace how cmd substitutions are currently represented and expanded, then resolve the behavior for string, iterable, and shell-based commands. Done means the accepted API handles multi-argument substitutions without breaking the existing forms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100