sentry-cli icon indicating copy to clipboard operation
sentry-cli copied to clipboard

sentry-cli bash-hook fails if using perl and any error happens

Open armenzg opened this issue 2 years ago • 3 comments

CC @mitsuhiko

$ cat foo.sh
sentry-cli bash-hook > foo.txt
eval "$(sentry-cli bash-hook)"
exit 2

$ ./foo.sh
./foo.sh: eval: line 63: syntax error near unexpected token `>'

That's probably this line:

1> >(tee >(perl '-MPOSIX' -ne '$|++; print strftime("%Y-%m-%d %H:%M:%S %z: ", localtime()), "stdout: ", $_;' >> "$_SENTRY_LOG_FILE")) \

armenzg avatar Jun 24 '22 18:06 armenzg

@armenzg do you have an idea which shell is executing this for you?

mitsuhiko avatar Jun 24 '22 18:06 mitsuhiko

$SHELL says /bin/zsh

cat foo.sh
sentry-cli bash-hook > foo.txt
echo $SHELL
eval "$(sentry-cli bash-hook)"

armenzg avatar Jul 05 '22 14:07 armenzg

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar Jul 27 '22 00:07 github-actions[bot]

@armenzg Per the docs, and per the name of the command being bash-hook, the bash-hook only supports being run in the bash shell. Using zsh is unsupported.

Fixing your problem is as simple as using bash to run the foo.sh script, like so:

$ bash foo.sh

You should receive the output: "error: No DSN provided" when running with bash.

See also https://github.com/getsentry/sentry-cli/issues/1848.

szokeasaurusrex avatar Feb 20 '24 15:02 szokeasaurusrex