NREL / OpenStudio-workflow-gem

http://openstudio.net
Other
14 stars 4 forks source link

Fix for openstudio issue 4150 #130

Closed tijcolem closed 3 years ago

tijcolem commented 3 years ago

This is fix for https://github.com/NREL/OpenStudio/issues/4150

This seems to only happen when using the OpenStudio CL vs pure ruby.

I think the issue is in load.c in ruby but not sure exactly where. When loading measure that has catches LoadError type,, the cwd is changed to root / and causes issues. We can simply maintain the cwd by changing dir after the load call.


 begin
   # try to load a non existent gem to force LoadError
   require "a-gem-that-does-not-exist"
 rescue LoadError
   puts "Failed to load. Keep moving"