       if results
         pathCount++
         resultCount += results.results.length
-        console.log "#{results.results.length} matches in #{results.path}"
+        console.log "#{results.results.length} matches in #{results.path}" if options.verbose
 
     maybeEnd()
 


  searchProcess.stdout.pipe(split()).on 'data', (line) ->
    if line[0] == START_CHAR
      console.log "search start"
    else if line[0] == END_CHAR
      searches--
      console.log "search end #{searches}"
    else if line and line.length
      try
        results = JSON.parse(line)

  searcher = new PathSearcher()
  regex = new RegExp(options.search, 'gi')

  soFar = ''
  readLines = (stdin) ->
    buf = stdin.read()
    return null unless buf

    # Lifted from https://github.com/dominictarr/split/blob/master/index.js
    pieces = (soFar + buf).split('\n')
    soFar = pieces.pop()
    pieces

  process.stdin.on 'readable', ->
    lines = readLines(process.stdin)
    return unless lines

    for line in lines
      emitStart()
      if !line or line[0] == STOP_CHAR
        emitEnd()
      else
        paths = JSON.parse(line)
        searcher.searchPaths regex, paths, (results) ->
          emitResults(results)

multiProcessSearchMain = (options) ->
  options.pathToScan = path.resolve(options.pathToScan)
