   onDidWriteToStderr: (callback) =>
     @emitter.on 'did-write-to-stderr', callback
 
-  stdinFunc: null
-
   destroy: ->
-    @eitter.dispose()
+    @emitter.dispose()
 
   getCwd: ->
     cwd = @runOptions.workingDirectory

class Runner
  bufferedProcess: null

  constructor: (@runOptions, @emitter = new Emitter) ->

  run: (command, extraArgs, codeContext) ->
    @startTime = new Date()
    @command = command

    args = @args(codeContext, extraArgs)
    exit = @onExit
    stdout = @stdoutFunc
    stderr = @stderrFunc
    options = @options()

    @bufferedProcess = new BufferedProcess({
      command, args, options, stdout, stderr, exit
    })

    @stdinFunc(@bufferedProcess.process.stdin) if @stdinFunc

    @bufferedProcess.onWillThrowError(@createOnErrorFunc(command))


    args = (@runOptions.cmdArgs.concat extraArgs).concat @runOptions.scriptArgs
    if not @runOptions.cmd? or @runOptions.cmd is ''
      args = codeContext.shebangCommandArgs().concat args
    args
