build.run: ensure shell script is run with /bin/sh.

Fixes #665.
This commit is contained in:
Catherine 2023-02-06 17:04:14 +00:00
parent dafefa87a9
commit 666ee27fd0

View file

@ -103,7 +103,7 @@ class BuildPlan:
finally: finally:
os.chdir(cwd) os.chdir(cwd)
def execute_remote_ssh(self, *, connect_to = {}, root, run_script=True): def execute_remote_ssh(self, *, connect_to={}, root, run_script=True):
""" """
Execute build plan using the remote SSH strategy. Files from the build Execute build plan using the remote SSH strategy. Files from the build
plan are transferred via SFTP to the directory ``root`` on a remote plan are transferred via SFTP to the directory ``root`` on a remote
@ -169,8 +169,9 @@ class BuildPlan:
channel = transport.open_session() channel = transport.open_session()
channel.set_combine_stderr(True) channel.set_combine_stderr(True)
cmd = "if [ -f ~/.profile ]; then . ~/.profile; fi && cd {} && sh {}.sh".format(root, self.script) cmd = (f"if [ -f ~/.profile ]; then . ~/.profile; fi && "
channel.exec_command(cmd) f"cd {root} && exec $0 {self.script}.sh")
channel.exec_command(f"sh -c '{cmd}'")
# Show the output from the server while products are built. # Show the output from the server while products are built.
buf = channel.recv(1024) buf = channel.recv(1024)