Skip to content

Commit 96f6bb1

Browse files
committed
fix windows
1 parent bdcc0f7 commit 96f6bb1

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/spec/test/AsyncAwaitSpecTest.groovy

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
*/
1919

2020
import org.junit.jupiter.api.Test
21-
import org.junit.jupiter.api.condition.DisabledOnOs
22-
import org.junit.jupiter.api.condition.OS
2321

2422
import static groovy.test.GroovyAssert.assertScript
2523

@@ -412,7 +410,6 @@ final class AsyncAwaitSpecTest {
412410
// === JDK Integration ===
413411

414412
@Test
415-
@DisabledOnOs(OS.WINDOWS)
416413
void testJdkIntegration() {
417414
assertScript '''
418415
import com.sun.net.httpserver.HttpServer
@@ -436,11 +433,16 @@ final class AsyncAwaitSpecTest {
436433
server.start()
437434
def bankUrl = "http://127.0.0.1:${server.address.port}"
438435
436+
// setup: portable echo command (Windows has no echo executable — it's a cmd built-in)
437+
def echoCmd = System.getProperty('os.name').toLowerCase().startsWith('windows')
438+
? ['cmd', '/c', 'echo Hello from Groovy']
439+
: ['echo', 'Hello from Groovy']
440+
439441
try {
440442
// tag::jdk_integration[]
441443
// Task 1: Run a process and await its completion
442444
def proc = async {
443-
def p = 'echo Hello from Groovy'.execute()
445+
def p = echoCmd.execute() // echo Hello from Groovy
444446
await p.onExit()
445447
p.text.trim()
446448
}

0 commit comments

Comments
 (0)