From: Herman Schultz Date: 2009-08-13T06:01:01+09:00 Subject: Re: Windows ENV object being corrupted Robert Klemme wrote: > 2009/8/12 Herman Schultz : >> >> >> So I get the sense that spaces are the issue, I believe that quoting >> variables with spaces would probably solve the issue but I haven't tried >> it yet. > > And what is your aim, i.e. what do you want to achieve? If you want > to set environment variables for your Ruby script, you could easily do > this instead: > > File.foreach "setEnvironment.bat" do |line| > if /^\s*([^\s=]+)\s*=\s*(.*)$/ =~ line > ENV[$1] = $2 > end > end > > and be done. Your approach looks suspiciously complicated to me. Of > course I may be missing something... > > Kind regards > > robert Thanks, Robert. I can't argue your approach isn't simpler. In fact, I can't remember why we ended up with this. All we really want is the same environment that the build system uses available for test and publishing systems. Your suggestion is noted. However, the problem with ENV still exists. The problem with spaces and large numbers of environment variables. It's just not in my way anymore. When I get a chance I will use your approach and see if I can re-create the problem from just parsing the setEnvironment.bat. Thanks, again. -- Posted via http://www.ruby-forum.com/.