in modules/core/src/main/scala/org/scalasteward/core/io/process.scala [119:151]
private def readLinesIntoBuffer[F[_]](
is: InputStream,
buffer: ListBuffer[String],
maxBufferSize: Int,
log: String => F[Unit]
)(implicit F: Sync[F]): F[Boolean] =
readUtf8Lines[F](is, maxBufferSize)
.evalMap(line => log(line).as(appendBounded(buffer, line, maxBufferSize)))
.compile
.fold(false)(_ || _)
private def readUtf8Lines[F[_]](
is: InputStream,
maxBufferSize: Int
)(implicit F: Sync[F]): Stream[F, String] =
fs2.io
.readInputStream(F.pure(is), chunkSize = 8192)
.through(fs2.text.utf8.decode)
.through(fs2.text.linesLimited(maxBufferSize))
private val bufferOverflowMessage =
s"If the process executed normally and the buffer size is just too small, you can " +
s"increase it with the --${Cli.name.maxBufferSize} command-line option and/or open " +
s"a pull request in ${org.scalasteward.core.BuildInfo.gitHubUrl} that increases the " +
s"default buffer size."
final class ProcessBufferOverflowException(
args: Args,
buffer: ListBuffer[String],
maxBufferSize: Int
) extends IOException(makeMessage(args, buffer) {
s"outputted more than $maxBufferSize lines. $bufferOverflowMessage"
})