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

Subprocess does not correctly escape strings #69

Open
TanzHasan opened this issue Jan 31, 2024 · 0 comments
Open

Subprocess does not correctly escape strings #69

TanzHasan opened this issue Jan 31, 2024 · 0 comments

Comments

@TanzHasan
Copy link
Collaborator

 _, err = subprocess.Popen(iwyu, stderr=subprocess.PIPE, text=True).communicate()

This line will fail occasionally because subprocess does not appropriately escape strings. This issue can be resolved by turning iwyu into a string and setting shell=True.

These settings are why the below runs without issue:

def build(command: List[str], directory: str):
    """Runs a command as a subprocess to build a .i file in the target directory"""
    os.chdir(directory)
    try:
        subprocess.check_call(" ".join(command), shell=True)

This issue was identified during the last day of development but an appropriate solution beyond shell=True has not been identified.

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