Closed juergenhoetzel closed 8 years ago
Please, do not merge. I need to test this properly. Seems like script
depending on Bash doesn't work properly anymore -- and also, seems like Env Vars are not exported properly.
Seems like script depending on Bash doesn't work properly anymore -- and also, seems like Env Vars are not exported properly.
Exporting works for me. But I can confirm the script
issue:
Unmatched '.
Seems to be a quoting issue
It is something that must be necessary in order to Sup works fine, the /bin/sh
shell, unfortunately Sup must require the existence of /bin/sh
in the remote host and the internal commands at Sup need to "force" the /bin/sh
style.
@juergenhoetzel Could you please show us that script, or some script that fails like your script.
Given Supfile
commands:
build:
script: ./build.sh
and ./build.sh:
#!/bin/bash -eu
[[ "hello" != "there" ]] && exit 0 || exit 1
We need to make sure this is run under Bash, since there's #!/bin/bash
at the very beginning of the file. Otherwise, we're gonna break things for many users. Actually, this bite me yesterday pretty bad, since ENV VARs didn't work properly and coincidently, this managed to kill one of my servers.
I don't want to implement parser for the script's first line on a Golang side. We need to figure out a native solution in /bin/sh
itself.
@juergenhoetzel btw: does your FreeBSD have /bin/bash natively? I'm inclined to switch to Bash by default for now, if available everywhere.
A native solution to check which interpreter is using, is echo $0
@juergenhoetzel btw: does your FreeBSD have /bin/bash natively? I'm inclined to switch to Bash by default for now, if available everywhere.
Bash
is not part of the base system. It has to be installed from ports: /usr/local/bin/bash
A portable way to invoke bash would be:
#!/usr/bin/env bash
and ./build.sh:
!/bin/bash -eu
[[ "hello" != "there" ]] && exit 0 || exit 1
As far as I can see the shebang is not used in the sup
implementation. It's just a comment, because its send as shell command and is not executed as a script:
@juergenhoetzel correct, the idea is to let the remote shells parse the shebangs, since we want to use /bin/sh
by default. Thus, this /bin/sh
should invoke another bash, if it sees #!/bin/bash
shebank. I'm not a huge fun of temp files, but that might be an option.
I'm not a huge fun of temp files, but that might be an option.
This was exactly what i was thinking about. Have you considered using sftp
subsystem for file transfer?
https://github.com/pkg/sftp instead of piping?
Closing in favor of #77.
Fixes issues on BSDs where the default shell is tcsh and "export=" syntax is invalid. Refs #59.