0

Test.rb

Class Test

  %x( unset http_proxy )

  %x( unset https_proxy )

  %x( unset HTTP_PROXY )

  %x( unset HTTPS_PROXY )

  system ("echo $https_proxy") #result: http://10.10.10.10:8080

  system ("echo $https_proxy") #result: http://10.10.10.10:8080

  system ("echo $HTTPS_proxy") #result: http://10.10.10.10:8080 

  system ("echo $HTTP_proxy")  #result: http://10.10.10.10:8080

end

I cannot unset http_proxy in Ruby. Please could help me for this issue!

Community
  • 1
  • 1
Ken
  • 23
  • 3
  • 1
    Those commands all get executed in other processes and will not affect your current process nor your permanent environment. – Joe Mar 22 '18 at 17:10
  • 1
    If you're trying to modify your current program's environment, I think you can just delete that entry from ENV but I'm not sure. – Joe Mar 22 '18 at 17:11

1 Answers1

0

Your execution of ruby is a process "child" of your computer. Therefore you only get a COPY of the parent environement .

sources : http://blog.honeybadger.io/ruby-guide-environment-variables/ similar request in python : Is it possible to change the Environment of a parent process in python?

plombix
  • 396
  • 3
  • 13