Skip to content

Commit

Permalink
fix: use shell to run cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
williamfzc committed Jul 25, 2023
1 parent 2b4c3f5 commit 5702493
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def gen_index(lang: str, directory: str, index_command: str):

if index_command:
logger.info(f"custom index command: {index_command}")
check_call(index_command.split(" "))
check_call(index_command)
return

if lang == "golang":
Expand Down Expand Up @@ -41,7 +41,7 @@ def gen_java_and_kotlin_index():
os.environ["JAVA_HOME"] = "/usr/lib/jvm/java-8-openjdk"

# https://sourcegraph.github.io/scip-java/docs/getting-started.html#run-scip-java-index
check_call(["scip-java", "index", "--output", "index.scip"])
check_call(["scip-java index --output index.scip"])


def gen_py_index():
Expand Down
9 changes: 7 additions & 2 deletions utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import os
import subprocess
import typing

from loguru import logger


def check_call(commands: list):
def check_call(commands: typing.Optional[str, list]):
logger.info(f"check calling: {commands}")
subprocess.check_call(commands, env=os.environ)
if isinstance(commands, str):
subprocess.check_call(commands, env=os.environ, shell=True)
else:
subprocess.check_call(commands, env=os.environ)

0 comments on commit 5702493

Please sign in to comment.