diff --git a/source/git.py b/source/git.py index b708505..271e821 100644 --- a/source/git.py +++ b/source/git.py @@ -1,6 +1,7 @@ import configparser import os import platform +import shlex import subprocess from pathlib import Path from typing import Optional @@ -23,10 +24,10 @@ def __run(command: str, cwd: Path) -> str: + args = shlex.split(f"{git} {command}") process = subprocess.Popen( - git + " " + command, + args, cwd=cwd, - shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, @@ -57,7 +58,8 @@ def toplevel(path: Path) -> Optional[Path]: def citool(repo_dir: Path) -> None: - subprocess.Popen(git_gui, cwd=repo_dir, shell=True) + args = shlex.split(git_gui) + subprocess.Popen(args, cwd=repo_dir) __all__ = ["version", "toplevel", "citool"]