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

Build: allow multi-line commands on build.commands #10334

Merged
merged 2 commits into from
May 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions readthedocs/doc_builder/environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,13 @@ def get_wrapped_command(self):
for part in self.command
)
)
return "/bin/sh -c '{prefix}{cmd}'".format(
prefix=prefix,
cmd=command,
)
if prefix:
# Using `;` or `\n` to separate the `prefix` where we define the
# variables with the `command` itself, have the same effect.
# However, using `;` is more explicit.
# See https://github.com/readthedocs/readthedocs.org/pull/10334
return f"/bin/sh -c '{prefix}; {command}'"
return f"/bin/sh -c '{command}'"

def _escape_command(self, cmd):
r"""Escape the command by prefixing suspicious chars with `\`."""
Expand Down