@@ -16,14 +16,11 @@ public async Task CreateAsync_ValidProcessInvalidServer_Throws()
1616 string id = Guid . NewGuid ( ) . ToString ( "N" ) ;
1717
1818 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 ) ;
2121
2222 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 ( ) ) ;
2724 }
2825
2926 [ Fact ( Skip = "Platform not supported by this test." , SkipUnless = nameof ( IsStdErrCallbackSupported ) ) ]
@@ -44,8 +41,8 @@ public async Task CreateAsync_ValidProcessInvalidServer_StdErrCallbackInvoked()
4441 } ;
4542
4643 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 ) ;
4946
5047 await Assert . ThrowsAsync < IOException > ( ( ) => McpClient . CreateAsync ( transport , loggerFactory : LoggerFactory , cancellationToken : TestContext . Current . CancellationToken ) ) ;
5148
0 commit comments