def slurp[F[_]]()

in modules/core/src/main/scala/org/scalasteward/core/io/process.scala [56:87]


  def slurp[F[_]](
      args: Args,
      timeout: FiniteDuration,
      maxBufferSize: Int,
      log: String => F[Unit]
  )(implicit F: Async[F]): F[List[String]] =
    createProcess(args).flatMap { process =>
      F.delay(new ListBuffer[String]).flatMap { buffer =>
        val raiseError = F.raiseError[List[String]]

        val result =
          readLinesIntoBuffer(process.getInputStream, buffer, maxBufferSize, log)
            .adaptErr { case t: fs2.text.LineTooLongException =>
              new ProcessLineTooLongException(args, buffer, maxBufferSize, t)
            }
            .flatMap { maxSizeExceeded =>
              F.blocking(process.waitFor()).flatMap { exitValue =>
                if (maxSizeExceeded && !args.slurpOptions(SlurpOption.IgnoreBufferOverflow))
                  raiseError(new ProcessBufferOverflowException(args, buffer, maxBufferSize))
                else if (exitValue === 0)
                  F.pure(buffer.toList)
                else
                  raiseError(new ProcessFailedException(args, buffer, exitValue))
              }
            }

        val onTimeout = F.blocking(process.destroyForcibly()) >>
          raiseError(new ProcessTimedOutException(args, buffer, timeout))

        F.timeoutAndForget(result, timeout).recoverWith { case _: TimeoutException => onTimeout }
      }
    }