Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Argument list converted to string incorrectly #114

Open
robertschweizer opened this issue Aug 29, 2023 · 0 comments
Open

Windows: Argument list converted to string incorrectly #114

robertschweizer opened this issue Aug 29, 2023 · 0 comments

Comments

@robertschweizer
Copy link

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant