Skip to content

Windows: Argument list converted to string incorrectly #114

Open
@robertschweizer

Description

@robertschweizer

When passing a list of arguments, subprocess-tee converts that to a single string with shlex.join. If one of the arguments contains a backslash, it is enclosed in single-quotes ('). This leads to the following error on Windows:

$ python -c "from subprocess_tee import run; import sys; run([sys.executable, '-V'], executable=None)"
The filename, directory name, or volume label syntax is incorrect.

Workaround

Pass the arguments as string.

Fix

shlex.join is only meant for POSIX systems. On Windows, subprocess.list2cmdline can be used to convert argument lists to strings, but is not officially part of the Python API (https://bugs.python.org/issue10838).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions