From: Herman Schultz Date: 2009-12-02T01:16:54+09:00 Subject: Rake Environment variables gone missing I posted this about six months ago but the form seems to have gone missing. Unfortunately, I have been sent back to work on the project from hell and am running into the same issue. The previous posts didn't produce much help as no one seems to be able to produce the problem but me. I am running on windows-xp machine with ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] and rake, version 0.8.1. Here's the issue. I read in a windows batch file that has a bunch of environment variable in it that are used in a hornets nest of Devstudio C++ projects. I want to parse the variables out and pass them to ENV so I can invoke incredibuild from rake. Here's the problem code. File.foreach env_batch_file do |line| if /^\s*SET\s*([^\s=]+)\s*=\s*(.*)$/i =~ line env_count = ENV.size() key = $1 value = resolve_variables($2) key.strip! value.strip! already_has_key = ENV.has_key?(key) ENV[key] = value.dup env_count = env_count + 1 if( env_count != ENV.size()) if ( already_has_key ) verbose("Variable already set.", 5) else verbose("ENV Hash whacked." , 1) end end end In this particular manifestation of the problem it happens when the ENV size grows to 360. Here's some output: 360: In Value = %IIE_SOURCE%\cen_xml_support\build\windows\static\release Rep = F:\source\iie\trunk Val = %IIE_SOURCE%\cen_xml_support\build\windows\static\release Val = F:\source\iie\trunk\cen_xml_support\build\windows\static\release No quotes. Return -> F:\source\iie\trunk\cen_xml_support\build\windows\static\release 360:ENV[CEN_XML_SUPPORT_REL_LIB_LOC] = F:\source\iie\trunk\cen_xml_support\build\windows\static\release ENV Hash whacked. 360:361 -> CEN_XML_SUPPORT_REL_LIB_LOC 360 I should note that in the very next attempt the size of ENV goes to 27! So something is going seriously wrong here. Any thoughts as to what specifically is failing. -- Posted via http://www.ruby-forum.com/.