From b653690804cebfc982935cbff0f22d04023a44b7 Mon Sep 17 00:00:00 2001 From: Oscar Boykin Date: Mon, 16 Dec 2024 09:33:38 -1000 Subject: [PATCH] Add IO.blocking, rename file to match object in cli --- cli/src/main/scala/org/bykn/bosatsu/Main.scala | 2 +- .../bosatsu/{TypedExprToProto.scala => ProtoConverter.scala} | 4 ++-- cli/src/test/scala/org/bykn/bosatsu/TestProtoType.scala | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename cli/src/main/scala/org/bykn/bosatsu/{TypedExprToProto.scala => ProtoConverter.scala} (99%) diff --git a/cli/src/main/scala/org/bykn/bosatsu/Main.scala b/cli/src/main/scala/org/bykn/bosatsu/Main.scala index 46deb9423..fee059324 100644 --- a/cli/src/main/scala/org/bykn/bosatsu/Main.scala +++ b/cli/src/main/scala/org/bykn/bosatsu/Main.scala @@ -8,7 +8,7 @@ object Main extends IOApp { case Right(getOutput) => PathModule.report(getOutput) case Left(help) => - IO { + IO.blocking { System.err.println(help.toString) ExitCode.Error } diff --git a/cli/src/main/scala/org/bykn/bosatsu/TypedExprToProto.scala b/cli/src/main/scala/org/bykn/bosatsu/ProtoConverter.scala similarity index 99% rename from cli/src/main/scala/org/bykn/bosatsu/TypedExprToProto.scala rename to cli/src/main/scala/org/bykn/bosatsu/ProtoConverter.scala index 43e4c49c3..92f52c1b9 100644 --- a/cli/src/main/scala/org/bykn/bosatsu/TypedExprToProto.scala +++ b/cli/src/main/scala/org/bykn/bosatsu/ProtoConverter.scala @@ -1450,7 +1450,7 @@ object ProtoConverter { def read[A <: GeneratedMessage]( path: Path )(implicit gmc: GeneratedMessageCompanion[A]): IO[A] = - IO { + IO.blocking { val f = path.toFile val ios = new BufferedInputStream(new FileInputStream(f)) try gmc.parseFrom(ios) @@ -1460,7 +1460,7 @@ object ProtoConverter { } def write(a: GeneratedMessage, path: Path): IO[Unit] = - IO { + IO.blocking { val f = path.toFile val os = new BufferedOutputStream(new FileOutputStream(f)) try a.writeTo(os) diff --git a/cli/src/test/scala/org/bykn/bosatsu/TestProtoType.scala b/cli/src/test/scala/org/bykn/bosatsu/TestProtoType.scala index f9f97c785..22a6f851d 100644 --- a/cli/src/test/scala/org/bykn/bosatsu/TestProtoType.scala +++ b/cli/src/test/scala/org/bykn/bosatsu/TestProtoType.scala @@ -55,7 +55,7 @@ class TestProtoType extends AnyFunSuite with ParTest { } def testWithTempFile(fn: Path => IO[Unit]): Unit = { - val tempRes = Resource.make(IO { + val tempRes = Resource.make(IO.blocking { val f = File.createTempFile("proto_test", ".proto") f.toPath }) { path =>