@@ -133,17 +133,22 @@ void testIsConnectedWithSocketClosed() throws Exception {
133133 pair .serverSocket .close ();
134134 }
135135
136+ private static Process startBlockingProcess () throws IOException {
137+ boolean isWindows = System .getProperty ("os.name" ).toLowerCase ().contains ("windows" );
138+ return (isWindows ? new ProcessBuilder ("cmd" , "/c" , "more" ) : new ProcessBuilder ("cat" )).start ();
139+ }
140+
136141 @ Test
137142 void testIsConnectedWithProcess () throws Exception {
138- Process proc = new ProcessBuilder ( "cat" ). start ();
143+ Process proc = startBlockingProcess ();
139144 try (var client = JsonRpcClient .fromProcess (proc )) {
140145 assertTrue (client .isConnected ());
141146 }
142147 }
143148
144149 @ Test
145150 void testIsConnectedWithProcessDead () throws Exception {
146- Process proc = new ProcessBuilder ( "cat" ). start ();
151+ Process proc = startBlockingProcess ();
147152 var client = JsonRpcClient .fromProcess (proc );
148153 proc .destroy ();
149154 proc .waitFor (5 , TimeUnit .SECONDS );
@@ -155,7 +160,7 @@ void testIsConnectedWithProcessDead() throws Exception {
155160
156161 @ Test
157162 void testGetProcessReturnsProcess () throws Exception {
158- Process proc = new ProcessBuilder ( "cat" ). start ();
163+ Process proc = startBlockingProcess ();
159164 try (var client = JsonRpcClient .fromProcess (proc )) {
160165 assertSame (proc , client .getProcess ());
161166 }
0 commit comments