flamegraph icon indicating copy to clipboard operation
flamegraph copied to clipboard

problem with envionment variables

Open zhangli-pear opened this issue 5 years ago • 7 comments

My program work with envionment variables, but it's seems like it cann't find them when I run flamegraph.

so how can i pass all the envionment variables to my program? And I'm working with MacOS.

zhangli-pear avatar Oct 31 '19 11:10 zhangli-pear

I'm experiencing the same issue.

agodnic avatar Dec 06 '19 17:12 agodnic

This happens with --root only, since sudo doesn't pass through environment variables by default. I'm not sure if doing that by default is a good idea though (it's not the default for a reason).

jonas-schievink avatar Dec 06 '19 17:12 jonas-schievink

This happens with --root only, since sudo doesn't pass through environment variables by default. I'm not sure if doing that by default is a good idea though (it's not the default for a reason).

root is required to run the command. Is that possible to add an option to allow passing envionment variables explicitly.

zhangli-pear avatar Dec 13 '19 05:12 zhangli-pear

Are maintainers open to a PR?

Do people prefer:

  • an extra flag to pass?
  • always passing with --root?

alextes avatar Jul 13 '22 12:07 alextes

Yes, I'm open to reviewing a PR. I think it should be explicit, would be nice if you can research what other existing tools use for the name of such an option. Looks like sudo calls it --preserve-env, so that might be a reasonable option?

djc avatar Jul 25 '22 08:07 djc

The question I have is: how to pass through environment variables at all? I am using env-logger and cannot get my logs without hardcoding a logging level.

SichangHe avatar Jun 23 '23 05:06 SichangHe

The question I have is: how to pass through environment variables at all? I am using env-logger and cannot get my logs without hardcoding a logging level.

Okay. Running with sudo --preserve-env=… without --root works.

SichangHe avatar Jun 23 '23 05:06 SichangHe