File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1717,7 +1717,7 @@ fn windows_unix_socket_exists() {
17171717 let tmp = tmpdir ( ) ;
17181718 let socket_path = tmp. join ( "socket" ) ;
17191719
1720- // std doesn't current support Unix sockets on Windows so manually create one here.
1720+ // std doesn't currently support Unix sockets on Windows so manually create one here.
17211721 net:: init ( ) ;
17221722 unsafe {
17231723 let socket = c:: WSASocketW (
@@ -1728,7 +1728,16 @@ fn windows_unix_socket_exists() {
17281728 0 ,
17291729 c:: WSA_FLAG_OVERLAPPED | c:: WSA_FLAG_NO_HANDLE_INHERIT ,
17301730 ) ;
1731- assert_ne ! ( socket, c:: INVALID_SOCKET ) ;
1731+ // AF_UNIX is not supported on earlier versions of Windows,
1732+ // so skip this test if it's unsupported and we're not in CI.
1733+ if socket == c:: INVALID_SOCKET {
1734+ let error = c:: WSAGetLastError ( ) ;
1735+ if env:: var_os ( "CI" ) . is_none ( ) && error == c:: WSAEAFNOSUPPORT {
1736+ return ;
1737+ } else {
1738+ panic ! ( "Creating AF_UNIX socket failed (OS error {error})" ) ;
1739+ }
1740+ }
17321741 let mut addr = c:: SOCKADDR_UN { sun_family : c:: AF_UNIX , sun_path : mem:: zeroed ( ) } ;
17331742 let bytes = socket_path. as_os_str ( ) . as_encoded_bytes ( ) ;
17341743 addr. sun_path [ ..bytes. len ( ) ] . copy_from_slice ( bytes) ;
You can’t perform that action at this time.
0 commit comments