@@ -3,8 +3,8 @@ package scala.cli.integration
3
3
import com .eed3si9n .expecty .Expecty .expect
4
4
5
5
import scala .cli .integration .util .BloopUtil
6
+ import scala .concurrent .ExecutionContext
6
7
import scala .concurrent .duration .Duration
7
- import scala .concurrent .{Await , ExecutionContext , Future }
8
8
9
9
class BloopTests extends ScalaCliSuite {
10
10
@@ -144,13 +144,8 @@ class BloopTests extends ScalaCliSuite {
144
144
test(" Restart Bloop server while watching" ) {
145
145
TestUtil .withThreadPool(" bloop-restart-test" , 2 ) { pool =>
146
146
val timeout = Duration (" 20 seconds" )
147
- def readLine (stream : os.SubProcess .OutputStream ): String = {
148
- implicit val ec = ExecutionContext .fromExecutorService(pool)
149
- val readLineF = Future {
150
- stream.readLine()
151
- }
152
- Await .result(readLineF, timeout)
153
- }
147
+ val ec = ExecutionContext .fromExecutorService(pool)
148
+
154
149
def content (message : String ) =
155
150
s """ object Hello {
156
151
| def main(args: Array[String]): Unit =
@@ -164,14 +159,14 @@ class BloopTests extends ScalaCliSuite {
164
159
inputs.fromRoot { root =>
165
160
val proc = os.proc(TestUtil .cli, " run" , " -w" , " ." )
166
161
.spawn(cwd = root)
167
- val firstLine = readLine(proc.stdout)
162
+ val firstLine = TestUtil . readLine(proc.stdout, ec, timeout )
168
163
expect(firstLine == " Hello" )
169
164
170
165
os.proc(TestUtil .cli, " bloop" , " exit" )
171
166
.call(cwd = root)
172
167
173
168
os.write.over(root / sourcePath, content(" Foo" ))
174
- val secondLine = readLine(proc.stdout)
169
+ val secondLine = TestUtil . readLine(proc.stdout, ec, timeout )
175
170
expect(secondLine == " Foo" )
176
171
177
172
proc.destroy()
0 commit comments