Skip to content

Using shell-words to split shell commands is weird #303

@CyberShadow

Description

@CyberShadow

Hi, thanks for creating shpool. This is more of a feedback ticket rather than a bug report, so feel free to close it.

What happened
I was surprised by the unusual behavior of the -c flag.

What I expected to happen
Usually, programs which accept another command to run do it in one of two ways:

  1. A program name and a list of arguments. For example, docker and env work in this way.
  2. A single string which is then passed to a shell's -c argument. Shells and ssh work in this way.

shpool does neither: it accepts a single string, but then only does one subset of the usual parsing that a shell would do. So, for example, ~ does not expand to $HOME, variables aren't expanded, and and piping / redirection doesn't work.

Since it's using a -c switch, I think the path of least surprise would be to do the equivalent of execv("/bin/sh", "-c", ...arguments...);.

To Reproduce
Steps to reproduce the behavior:
I think this is reproducible with something like shpool -c '~/bin/my_script'.

Version info
shpool 0.8.0

Logs
N/A

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