@@ -16,14 +16,11 @@ public async Task CreateAsync_ValidProcessInvalidServer_Throws()
16
16
string id = Guid . NewGuid ( ) . ToString ( "N" ) ;
17
17
18
18
StdioClientTransport transport = RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ?
19
- new ( new ( ) { Command = "cmd" , Arguments = [ "/c" , id ] } , LoggerFactory ) :
20
- new ( new ( ) { Command = "ls " , Arguments = [ id ] } , LoggerFactory ) ;
19
+ new ( new ( ) { Command = "cmd" , Arguments = [ "/c" , $ "timeout /t 2 /nobreak >nul & echo { id } >&2 & exit /b 1" ] } , LoggerFactory ) :
20
+ new ( new ( ) { Command = "sh " , Arguments = [ "-c" , $ "sleep 2s; echo { id } >&2; exit 1" ] } , LoggerFactory ) ;
21
21
22
22
IOException e = await Assert . ThrowsAsync < IOException > ( ( ) => McpClient . CreateAsync ( transport , loggerFactory : LoggerFactory , cancellationToken : TestContext . Current . CancellationToken ) ) ;
23
- if ( ! RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
24
- {
25
- Assert . Contains ( id , e . ToString ( ) ) ;
26
- }
23
+ Assert . Contains ( id , e . ToString ( ) ) ;
27
24
}
28
25
29
26
[ Fact ( Skip = "Platform not supported by this test." , SkipUnless = nameof ( IsStdErrCallbackSupported ) ) ]
@@ -44,8 +41,8 @@ public async Task CreateAsync_ValidProcessInvalidServer_StdErrCallbackInvoked()
44
41
} ;
45
42
46
43
StdioClientTransport transport = RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ?
47
- new ( new ( ) { Command = "cmd" , Arguments = [ "/c" , id ] , StandardErrorLines = stdErrCallback } , LoggerFactory ) :
48
- new ( new ( ) { Command = "ls " , Arguments = [ id ] , StandardErrorLines = stdErrCallback } , LoggerFactory ) ;
44
+ new ( new ( ) { Command = "cmd" , Arguments = [ "/c" , $ "timeout /t 2 /nobreak >nul & echo { id } >&2 & exit /b 1" ] , StandardErrorLines = stdErrCallback } , LoggerFactory ) :
45
+ new ( new ( ) { Command = "sh " , Arguments = [ "-c" , $ "sleep 2s; echo { id } >&2; exit 1" ] , StandardErrorLines = stdErrCallback } , LoggerFactory ) ;
49
46
50
47
await Assert . ThrowsAsync < IOException > ( ( ) => McpClient . CreateAsync ( transport , loggerFactory : LoggerFactory , cancellationToken : TestContext . Current . CancellationToken ) ) ;
51
48
0 commit comments