Fix for issue #903

This fixes Issue #903 ... changes the check to use the bufferSize rather than the return value from flush.

Unfortunately was not able to get the cli test working agin because of not
being able to stub the return value from process.stdout.bufferSize.