Skip to content

Commit

Permalink
Handle spaces in executable paths
Browse files Browse the repository at this point in the history
Fixes #5
  • Loading branch information
adamws committed Apr 29, 2024
1 parent 4eb441b commit d17df90
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions source/git.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import configparser
import os
import platform
import shlex
import subprocess
from pathlib import Path
from typing import Optional
Expand All @@ -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,
Expand Down Expand Up @@ -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"]

0 comments on commit d17df90

Please sign in to comment.