     if      o.tokens      then printTokens CoffeeScript.tokens t.input
     else if o.nodes       then printLine CoffeeScript.nodes(t.input).toString().trim()
     else if o.run         then CoffeeScript.run t.input, t.options
+    else if o.join and file isnt o.join
+      compileJoin t.file, t.input
     else
       t.output = CoffeeScript.compile t.input, t.options
       CoffeeScript.emit 'success', task

# compile them. If a directory is passed, recursively compile all
# '.coffee' extension source files in it and all subdirectories.
compileScripts = ->
  unprocessed = []
  remainingFiles = ->
    total = 0
    total += x for x in unprocessed
    total
  trackUnprocessedFiles = (sourceIndex, fileCount) ->
    unprocessed[sourceIndex] ?= 0
    unprocessed[sourceIndex] += fileCount
  trackCompleteFiles = (sourceIndex, fileCount) ->
    unprocessed[sourceIndex] -= fileCount
    if opts.join
      if helpers.compact(contents).length > 0 and remainingFiles() is 0
        compileJoin()
  for source in sources
    trackUnprocessedFiles sources.indexOf(source), 1
  for source in sources
    base = path.join(source)
    compile = (source, sourceIndex, topLevel) ->
      path.exists source, (exists) ->
        if topLevel and not exists and source[-7..] isnt '.coffee'
          return compile "#{source}.coffee", sourceIndex, topLevel
        if topLevel and not exists 
          console.error "File not found: #{source}"
          process.exit 1

  stdin.on 'end', ->
    compileScript null, code

# If all of the source files are done being read, concatenate and compile
# them together.
compileJoin = (file, code) ->
  sourceCode[sources.indexOf(file)] = code
  unless sourceCode.some((code) -> code is null)
    compileScript opts.join, sourceCode.join('\n'), opts.join

# Load files that are to-be-required before compilation occurs.
loadRequires = ->
