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

Make shell scripts work on Windows #437

Merged
merged 5 commits into from
Feb 10, 2020
Merged

Conversation

Artoria2e5
Copy link
Contributor

@Artoria2e5 Artoria2e5 commented Jan 30, 2020

The first commit changes run_shell_command to always launch the shell as if it is a program. Doing so removes the interoperability problem with Python's interpretation of shell = True on different platforms. After this commit, augur align fails correctly with a 127 (command not found) exit value on Windows.

I have also modified to print the stdout/err on error, since doing so makes debug a bit easier.

The second commit shell-quotes all user-specified filenames. This is to avoid strange errors and scary "command injection vulnerabilities" with weird-looking filenames.

@tsibley tsibley self-requested a review January 30, 2020 20:18
Copy link
Member

@tsibley tsibley left a comment

Choose a reason for hiding this comment

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

Thanks for this Windows compat work, @Artoria2e5! I left a few comments inline below.

I would eventually like to remove all shell command string usages in augur and switch to only argv lists, because it's really easy to forget to apply shlex.quote consistently to command strings. But in the meantime, this is still an improvement! :-)

augur/utils.py Outdated Show resolved Hide resolved
augur/utils.py Outdated Show resolved Hide resolved
augur/utils.py Outdated Show resolved Hide resolved
augur/utils.py Outdated Show resolved Hide resolved
augur/utils.py Outdated Show resolved Hide resolved
augur/utils.py Outdated Show resolved Hide resolved
augur/utils.py Outdated Show resolved Hide resolved
@Artoria2e5 Artoria2e5 requested a review from tsibley February 6, 2020 07:25
@tsibley tsibley merged commit 6332017 into nextstrain:master Feb 10, 2020
@tsibley
Copy link
Member

tsibley commented Feb 10, 2020

Thanks @Artoria2e5, merged!

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