是否可以(如果可以,如何?)读取正在运行的进程的环境变量。更具体地说,我关心的是进程本身设置的环境变量(使用 setenv() 或类似的),而不是进程启动时设置的一般用户会话环境变量。
我认为 DTrace 将是完成这项工作的工具,但这是我在网上找到的唯一解决方案(来自 此邮件列表主题)似乎特定于 Solaris,因为该脚本无法在我的 Mac 上执行。
也许 Instruments 以某种方式公开了此功能,但我只是还没有找到它?
我也尝试过 Tasks Explorer,这是一个不错的小应用程序,它显示了包括环境变量在内的进程信息,但它不显示由过程本身,这就是我所追求的。
任何帮助将不胜感激!
Is it possible (and if so, how?) to read a running process's environment variables. To be more specific, I am concerned with environment variables set by the process itself (using setenv() or similar), not the general user session environment variables set when the process is launched.
I figured that DTrace would be the tool for this job, but the only solution I've found online (from this mailing list thread) appears to be specific to Solaris because the script fails to execute on my Mac.
Perhaps Instruments exposes this functionality somehow and I just haven't found it yet?
I have also tried Tasks Explorer, which is a nice little application, and it shows process info including environment variables, but it does not show any environment variables set by the process itself, which is what I'm after.
Any help would be much appreciated!
发布评论
评论(1)
我想你可以尝试下一种方法:
顺便说一句,我计划将这种类型的环境变量探索添加到我的任务资源管理器中。
接下来的链接将帮助您进行注入:
I suppose you could try next way:
By the way, I have a plan to add this type of environment variables exploring into my Tasks Explorer.
Next links will help you with injection: