src/tasks/run.js
function waitForReadyOutput() {
      function onCloseBeforeReady(exitCode) {
        done(exitCode && new Error('non-zero exit code ' + exitCode));
      }

      let outputBuffer = '';

      function checkChunkForReady(chunk) {
        outputBuffer += chunk.toString('utf8');

        // ensure the buffer doesn't grow out of control
        if (outputBuffer.length >= opts.readyBufferLength) {
          outputBuffer = outputBuffer.slice(outputBuffer.length - opts.readyBufferLength);
        }

        // don't strip ansi until we check, incase an ansi marker is split across chuncks.
        if (!opts.ready.test(stripAnsi(outputBuffer))) return;

        outputBuffer = '';
        proc.removeListener('close', onCloseBeforeReady);
        proc.stdout.removeListener('data', checkChunkForReady);
        proc.stderr.removeListener('data', checkChunkForReady);
        done();
      }

      proc.on('close', onCloseBeforeReady);
      proc.stdout.on('data', checkChunkForReady);
      proc.stderr.on('data', checkChunkForReady);
    }
function waitForReadyOutput() {
      function onCloseBeforeReady(exitCode) {
        done(exitCode && new Error('non-zero exit code ' + exitCode));
      }

      let outputBuffer = '';

      function checkChunkForReady(chunk) {
        outputBuffer += chunk.toString('utf8');

        // ensure the buffer doesn't grow out of control
        if (outputBuffer.length >= opts.readyBufferLength) {
          outputBuffer = outputBuffer.slice(outputBuffer.length - opts.readyBufferLength);
        }

        // don't strip ansi until we check, incase an ansi marker is split across chuncks.
        if (!opts.ready.test(stripAnsi(outputBuffer))) return;

        outputBuffer = '';
        proc.removeListener('close', onCloseBeforeReady);
        proc.stdout.removeListener('data', checkChunkForReady);
        proc.stderr.removeListener('data', checkChunkForReady);
        done();
      }

      proc.on('close', onCloseBeforeReady);
      proc.stdout.on('data', checkChunkForReady);
      proc.stderr.on('data', checkChunkForReady);
    }
function waitForReadyOutput ( ) { function onCloseBeforeReady ( exitCode ) { done ( exitCode && new Error ( 'non-zero exit code ' + exitCode ) ) ; } let outputBuffer = '' ; function checkChunkForReady ( chunk ) { outputBuffer += chunk . toString ( 'utf8' ) ; // ensure the buffer doesn't grow out of control if ( outputBuffer . length >= opts . readyBufferLength ) { outputBuffer = outputBuffer . slice ( outputBuffer . length - opts . readyBufferLength ) ; } // don't strip ansi until we check, incase an ansi marker is split across chuncks. if ( ! opts . ready . test ( stripAnsi ( outputBuffer ) ) ) return ; outputBuffer = '' ; proc . removeListener ( 'close' , onCloseBeforeReady ) ; proc . stdout . removeListener ( 'data' , checkChunkForReady ) ; proc . stderr . removeListener ( 'data' , checkChunkForReady ) ; done ( ) ; } proc . on ( 'close' , onCloseBeforeReady ) ; proc . stdout . on ( 'data' , checkChunkForReady ) ; proc . stderr . on ( 'data' , checkChunkForReady ) ; }
we are scanning the output for a specific regular expression
we are scanning the output for a specific regular expression