sh 'unset http_proxy' changes the shell launched for that call. When it exits, Rake's Ruby process still has its original environment, and a later sh call inherits it again.

To change the Ruby process for subsequent work:

ENV.delete('http_proxy')
ENV.delete('HTTP_PROXY')

That affects later children and Ruby code reading those keys. It does not reconfigure the terminal that originally launched Rake.

For one child command, supply its environment directly:

sh(
  { 'http_proxy' => nil, 'HTTP_PROXY' => nil },
  'ruby', 'download.rb'
)

Ruby's process-launch interface treats nil values as removals from that child's environment. Rake passes the argument list to that interface, leaving its own ENV unchanged.

Remove the keys relevant to the actual client. An HTTPS operation may also consume https_proxy, and some clients consult ALL_PROXY or another configuration file. Removing one HTTP key alone is not a universal direct-route instruction.

The multiple-argument form keeps executable arguments separate. There is no need to construct a shell string containing an unset command and a URL.

Tënë sô zo