granted
granted copied to clipboard
fix assume script not printing output properly on linux
Fixes #255.
Sometimes Granted needs to print to stdout. Our assume
wrapper script needs to capture Granted's output in a specific format, so we prepend anything that needs to be printed with GrantedOutput
. assume
then chops the GrantedOutput
prefix off and prints the rest to stdout.
For running commands like assume my-profile --exec "echo hello world"
, the output that the assumego
Go binary creates is:
GrantedOutput
hello world
Which is then interpreted by the assume
wrapper, and finally printed to the console as
hello world
the problem
Bash on Ubuntu was printing
GrantedOutput <URL>
Whereas the assume
script requires the output to look like
GrantedOutput
<URL>
with a newline in between.
Confirming that this resolves the reported issue. Nice work!
shellcheck
is often good at finding these kinds of issues. It's basically static analysis linter for shell scripts. I often run it in CI and let it pass/fail the PR.
Fantastic suggestion @lorengordon, I've added support for shellcheck in our CI in #265. Shellcheck correctly caught the issue in #255 too.