From: Robert Klemme Date: 2009-08-13T18:48:39+09:00 Subject: Re: Windows ENV object being corrupted --001636416b43ed8d82047102d6f3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 2009/8/12 Herman Schultz : > 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 trie= d >>> it yet. >> >> And what is your aim, i.e. what do you want to achieve? =A0If you want >> to set environment variables for your Ruby script, you could easily do >> this instead: >> >> File.foreach "setEnvironment.bat" do |line| >> =A0 if /^\s*([^\s=3D]+)\s*=3D\s*(.*)$/ =3D~ line >> =A0 =A0 ENV[$1] =3D $2 >> =A0 end >> end >> >> and be done. =A0Your approach looks suspiciously complicated to me. =A0O= f >> course I may be missing something... > > Thanks, Robert. =A0I can't argue your approach isn't simpler. =A0In 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. =A0Your suggestion is noted. > > However, the problem with ENV still exists. =A0The problem with spaces an= d > large numbers of environment variables. =A0It's just not in my way > anymore. =A0When I get a chance I will use your approach and see if I can > re-create the problem from just parsing the setEnvironment.bat. I was curious and created the test attached but could not provoke any issues with spaces. I am pretty sure that the size of the environment is limited somehow but I did not hit a limit or any issues with my test (at 36,000 and still running). What's going on here? robert --=20 remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/ --001636416b43ed8d82047102d6f3 Content-Type: application/octet-stream; name="env-test.rb" Content-Disposition: attachment; filename="env-test.rb" Content-Transfer-Encoding: base64 X-Attachment-Id: f_fybb59rn0 IyFydWJ5MTkgLXcKCnJlcXVpcmUgJ3BwJwoKaDEgPSBFTlYudG9faGFzaApiYXNlID0gRU5WLnNp emUKaSA9IDEKCmxvb3AgZG8KICBwcmludGYgIiUxMGRcbiIsIGkgaWYgaSAlIDEwMDAgPT0gMAog IGtleSA9ICJrI3tpfSIKICBFTlZba2V5XSA9ICdhIHNwYWNlJwogIGgyID0gRU5WLnRvX2hhc2gK CiAgaWYgRU5WLnNpemUgIT0gYmFzZSArIGkgfHwgaDIuc2l6ZSA9PSBoMS5zaXplIHx8IGgyID09 IGgxIHx8IGgyW2tleV0gIT0gJ2Egc3BhY2UnCiAgICAjIGRldGVjdCB1bmNoYW5nZWQKICAgIHBw IGksIGgxLCBoMgogICAgZXhpdAogIGVuZAoKICBoMSA9IGgyCgogICMgcHJpbnRmICIlMTBkXG4i LCBpIGlmIGkgJSAxMF8wMDAgPT0gMAogIGkgKz0gMQplbmQK --001636416b43ed8d82047102d6f3--