# File lib/librarian/posix.rb, line 59
        def run!(command, options = { })
          out, err = nil, nil
          chdir = options[:chdir].to_s if options[:chdir]
          env = options[:env] || { }
          old_env = Hash[env.keys.map{|k| [k, ENV[k]]}]
          out, err, wait = nil, nil, nil
          begin
            ENV.update env
            Dir.chdir(chdir || Dir.pwd) do
              IO.popen3(*command) do |i, o, e, w|
                rescuing(Errno::EBADF){ i.close } # jruby/1.9 can raise EBADF
                out, err, wait = o.read, e.read, w
              end
            end
          ensure
            ENV.update old_env
          end
          s = wait ? wait.value : $? # wait is 1.9+-only
          s.success? or CommandFailure.raise! command, s, err
          out
        end