diff --git a/readthedocs/doc_builder/environments.py b/readthedocs/doc_builder/environments.py index e35afe18f90..cea39d47fe7 100644 --- a/readthedocs/doc_builder/environments.py +++ b/readthedocs/doc_builder/environments.py @@ -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 `\`."""