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

Use base64 -d on all Linux platforms and --decode on others #1

Merged
merged 1 commit into from
Oct 25, 2022
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
17 changes: 15 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,25 @@ function tobool() {
fi
}

_temp_dir=$(echo "$1" | base64 -d); shift
# Account for platform differences in base64 command
# Taken from @nknapp contribution to traefik: traefik/traefik#2344
case "$(uname)" in
'Linux')
# On Linux, -d should always work. --decode does not work with Alpine's busybox-binary
CMD_DECODE_BASE64="base64 -d"
;;
*)
# Max OS-X supports --decode and -D, but --decode may be supported by other platforms as well.
CMD_DECODE_BASE64="base64 --decode"
;;
esac

_temp_dir=$(echo "$1" | ${CMD_DECODE_BASE64}); shift
_id="$1"; shift
_exit_on_nonzero="$(tobool "$1")"; shift
_exit_on_stderr="$(tobool "$1")"; shift
_exit_on_timeout="$(tobool "$1")"; shift
_command=$(echo "$1" | base64 -d); shift
_command=$(echo "$1" | ${CMD_DECODE_BASE64}); shift
_stdoutfile_name="$1"; shift
_stderrfile_name="$1"; shift
_exitcodefile_name="$1"; shift
Expand Down