support Dir.chdir with block