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

Shlex does not parse Windows paths correctly #3649

Closed
JesperDramsch opened this issue Dec 10, 2022 · 0 comments · Fixed by #3651
Closed

Shlex does not parse Windows paths correctly #3649

JesperDramsch opened this issue Dec 10, 2022 · 0 comments · Fixed by #3651
Labels

Comments

@JesperDramsch
Copy link
Contributor

Environment

Python Version:
3.10.8

Nikola Version:
v8.2.3

Operating System:
Windows

Description:

The Gzip task used shlex to lexically parse input commands from GZIP_COMMAND.

The example is "pigz -k {filename}", however this causes an "error in pigz" because pigz -k outputlatestindex.html does not exist.

This is a know problem of shlex:

https://stackoverflow.com/questions/33560364/python-windows-parsing-command-lines-with-shlex

Proposed solution:

Change command to

    if command:
        if sys.platform == 'win32':
            subprocess.check_call(command.format(filename=in_path))
        else:
            subprocess.check_call(shlex.split(command.format(filename=in_path)))

from the StackOverflow, which would be the cleanest option.

@Kwpolska Kwpolska mentioned this issue Dec 10, 2022
3 tasks
@Kwpolska Kwpolska linked a pull request Dec 10, 2022 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant