Skip to content

Commit

Permalink
Run configure command using shell=True.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgautierfr committed Nov 23, 2023
1 parent 171289d commit cb269ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion kiwixbuild/dependencies/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ def _configure(self, context):
]
env = self.get_env(cross_comp_flags=True, cross_compilers=True, cross_path=True)
self.set_configure_env(env)
run_command(command, self.build_path, context, env=env)
run_command(command, self.build_path, context, env=env, shell=True)

def _compile(self, context):
context.try_skip(self.build_path)
Expand Down
6 changes: 4 additions & 2 deletions kiwixbuild/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,16 @@ def extract_archive(archive_path, dest_dir, topdir=None, name=None):
archive.close()


def run_command(command, cwd, context, *, env=None, input=None):
def run_command(command, cwd, context, *, env=None, input=None, shell=False):
os.makedirs(cwd, exist_ok=True)
if env is None:
env = DefaultEnv()
log = None
try:
if not option('verbose'):
log = open(context.log_file, 'w')
if shell:
command = shlex.join(command)
print("run command '{}'".format(command), file=log)
print("current directory is '{}'".format(cwd), file=log)
print("env is :", file=log)
Expand All @@ -295,7 +297,7 @@ def run_command(command, cwd, context, *, env=None, input=None):
if input:
kwargs['stdin'] = subprocess.PIPE
print("Command is", command)
process = subprocess.Popen(command, cwd=cwd, env=env, stdout=log or sys.stdout, stderr=subprocess.STDOUT, **kwargs)
process = subprocess.Popen(command, cwd=cwd, env=env, stdout=log or sys.stdout, stderr=subprocess.STDOUT, shell=shell, **kwargs)
if input:
input = input.encode()
while True:
Expand Down

0 comments on commit cb269ba

Please sign in to comment.