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"
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.