def configure_executioner(executioner, options)
      # set specific environment variables, if requested.
      sev = options[:set_env_vars]
      if (sev && !sev.empty?)
        executioner = lambda do |e|
          lambda { set_env_vars(sev) { e.call } }
        end.call(executioner)
      end

      # clear specific environment variables, if requested.
      cev = options[:clear_env_vars]
      if (cev && !cev.empty?)
        executioner = lambda do |e|
          lambda { clear_env_vars(cev) { e.call } }
        end.call(executioner)
      end

      # working directory.
      if directory = options[:directory]
        executioner = lambda do |e, d|
          lambda { ::Dir.chdir(d) { e.call } }
        end.call(executioner, directory)
      end
      executioner
    end
def configure_executioner(executioner, options)
      # set specific environment variables, if requested.
      sev = options[:set_env_vars]
      if (sev && !sev.empty?)
        executioner = lambda do |e|
          lambda { set_env_vars(sev) { e.call } }
        end.call(executioner)
      end

      # clear specific environment variables, if requested.
      cev = options[:clear_env_vars]
      if (cev && !cev.empty?)
        executioner = lambda do |e|
          lambda { clear_env_vars(cev) { e.call } }
        end.call(executioner)
      end

      # working directory.
      if directory = options[:directory]
        executioner = lambda do |e, d|
          lambda { ::Dir.chdir(d) { e.call } }
        end.call(executioner, directory)
      end
      executioner
    end
Encapsulates the given executioner with child-process-modifying behavior
 based on options. Builds the executioner as a series of callbacks.

 @param [Proc] executioner to configure
 @param [Hash] options for execution

 @return [Proc] configured executioner