docs: function run(baseDir, privKey, cmd, keyMode, cb) {
    var detached = true
    var spawnFn = spawn
    if (typeof(keyMode) === 'function') {
      cb = keyMode
      keyMode = 0600
    }
  
    if (typeof(baseDir) === 'object') {
      var opts = baseDir
      cb = privKey
      cmd = opts.cmd
      privKey = opts.privKey
      keyMode = opts.keyMode || 0600
      emitter = opts.emitter
      baseDir = opts.baseDir
      spawnFn = opts.spawn || spawn
      if (typeof(opts.detached) !== 'undefined') {
        detached = opts.detached
      }
    }
  
    var split = cmd.split(/\s+/)
    var cmd = split[0]
    var args = split.slice(1)
  
    Step(
      function() {
        writeFiles(privKey, null, keyMode, this)
      },
      function(err, file, keyfile) {
        if (err) {
          console.log("Error writing files: %s", err)
          return cb(err, null)
        }
        this.file = file
  	this.keyfile = keyfile
        var proc = spawnFn(cmd, args, {cwd: baseDir, env: {GIT_SSH: file, PATH:PATH}, detached: detached})
        proc.stdoutBuffer = ""
        proc.stderrBuffer = ""
        proc.stdout.setEncoding('utf8')
        proc.stderr.setEncoding('utf8')
  
  	proc.stdout.on('data', function(buf) {
  
          if (typeof(emitter) === 'object') {
            emitter.emit('stdout', buf)
          }
          proc.stdoutBuffer += buf
        })
  
        proc.stderr.on('data', function(buf) {
  
            if (typeof(emitter) === 'object') {
            emitter.emit('stderr', buf)
          }
          proc.stderrBuffer += buf
        })
  
        var self = this
        proc.on('close', function(exitCode) {
  
            var err = null
          if (exitCode !== 0) {
            err = "process exited with status " + exitCode
          }
          self(err, proc.stdoutBuffer, proc.stderrBuffer, exitCode)
        })
        proc.on('error', function (err) {
          // prevent node from throwing an error. The error handling is
          // done in the 'close' handler.
        })
      },
      function(err, stdout, stderr, exitCode) {
        // cleanup temp files
        try {
          fs.unlink(this.file)
          fs.unlink(this.keyfile)
        } catch(e) {}
  
        cb(err, stdout, stderr, exitCode)
      }
    )
  }