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

eval $(apmz bash ...) doesn't work #14

Open
joelbernstein opened this issue Apr 27, 2021 · 5 comments
Open

eval $(apmz bash ...) doesn't work #14

joelbernstein opened this issue Apr 27, 2021 · 5 comments

Comments

@joelbernstein
Copy link

bash-5.1$ eval $( ~/go/bin/apmz bash )
Warning: apmz event collection is enabled, but --api-keys is not specified. You must override the __APP_INSIGHTS_KEY env var or events will not be set to Application Insights on script exit.
bash-5.1$ eval $( ~/go/bin/apmz bash --api-keys MY-API-KEY-WENT-HERE )
bash-5.1$ trace_info foo
bash: trace_info: command not found
@joelbernstein
Copy link
Author

However, this does seem to work:

export PATH=$HOME/go/bin:$PATH
apmz bash --api-keys MY-API-KEY-WENT-HERE  > /tmp/bash
source /tmp/bash
trace_info foo

I presume there's something about the output of apmz bash that eval doesn't like. But source does.

@joelbernstein
Copy link
Author

GNU bash, version 5.1.4(1)-release (x86_64-apple-darwin19.6.0)

@joelbernstein
Copy link
Author

Having said it "works", I'm not so sure, because I can't find the result of trace_info someuniquetexthere when searching under Application Insights -> "transaction search" in the Azure portal.

Does this tool actually work?

@joelbernstein joelbernstein changed the title Doesn't seem to work as documented eval $(apmz bash ...) doesn't work Apr 27, 2021
@devigned
Copy link
Owner

Haven't been using 5.1, so this very well could be the case. I can verify eval works on.

$ bash --version
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)

With that said, the eval is pretty nasty. Probably better to pipe and then source. I just wanted an easy one liner for folks.

As for the main issue, I think it all stems back to #15.

@joelbernstein
Copy link
Author

Hi! Thanks very much for checking. If I had to guess, the issue may be related to set -e being on by default. But I agree, bash-fu aside, this is about #15.

I'd be more than willing to submit some documentation examples to replace the eval call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants