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

Run subprocesses through shell on Windows #62

Merged
merged 2 commits into from
Jan 6, 2025

Conversation

XanderVertegaal
Copy link
Contributor

Partly solves #48

Without shell=True, almost every call of subprocess.call() fails on Windows; if I add it, (almost) everything works right out of the box.

This will probably be hard to test for non-Windows users. I'm mainly concerned about the potential security risk mentioned on StackExchange.

Since we're using cookiecutter to set up a local project and all input is controlled, the risk of allowing arbitrary code execution seems very small.

Copy link
Contributor

@jgonggrijp jgonggrijp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully this will soon be obsolete because of Docker, but in the meanwhile, I'm all for it!

# On Windows, we need to run the command through the shell to get
# access to commands in PATH.
exit_code = subprocess.call(
self.command, *self.args, **self.kwargs, shell=WINDOWS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clever.

@XanderVertegaal XanderVertegaal merged commit c4e5a4a into develop Jan 6, 2025
4 checks passed
@XanderVertegaal XanderVertegaal deleted the feature/windows-support branch January 6, 2025 11:05
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

Successfully merging this pull request may close these issues.

2 participants