# File lib/chef/mixin/command.rb, line 208
      def chdir_or_tmpdir(dir, &block)
        dir ||= Dir.tmpdir
        unless File.directory?(dir)
          raise Chef::Exceptions::Exec, "#{dir} does not exist or is not a directory"
        end
        Dir.chdir(dir) do
          block.call
        end
      end