有没有办法改变另一个进程的环境变量? [英] Is there a way to change another process's environment variables?
本文介绍了有没有办法改变另一个进程的环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
编辑:通过gdb如何?
解决方案
通过gdb:
gdb)attach process_id
(gdb)call putenv(env_var_name = env_var_value)
(gdb)detach
这是一个讨厌的黑客,当然只能在调试场景的上下文中完成。
On Unix, is there any way that one process can change another's environment variables (assuming they're all being run by the same user)? A general solution would be best, but if not, what about the specific case where one is a child of the other?
Edit: How about via gdb?
解决方案
Via gdb:
(gdb) attach process_id
(gdb) call putenv ("env_var_name=env_var_value")
(gdb) detach
This is quite a nasty hack and should only be done in the context of a debugging scenario, of course.
这篇关于有没有办法改变另一个进程的环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文