File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
src/test/java/com/github/copilot/sdk Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -70,13 +70,18 @@ void connectToServerTcpMode() throws Exception {
7070 }
7171 }
7272
73+ private static Process startBlockingProcess () throws IOException {
74+ boolean isWindows = System .getProperty ("os.name" ).toLowerCase ().contains ("windows" );
75+ return (isWindows ? new ProcessBuilder ("cmd" , "/c" , "more" ) : new ProcessBuilder ("cat" )).start ();
76+ }
77+
7378 @ Test
7479 void connectToServerStdioMode () throws Exception {
7580 var options = new CopilotClientOptions ();
7681 var manager = new CliServerManager (options );
7782
7883 // Create a dummy process for stdio mode
79- Process process = new ProcessBuilder ( "cat" ). start ();
84+ Process process = startBlockingProcess ();
8085 try {
8186 JsonRpcClient client = manager .connectToServer (process , null , null );
8287 assertNotNull (client );
Original file line number Diff line number Diff line change @@ -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 }
You can’t perform that action at this time.
0 commit comments