Repository: sanic-org/sanic

Issue:
Sanic doesn't shutdown cleanly on Mac 
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

When running a simple server on mac os 13.1, after using ctrl-c to shutdown the app, a socket exception is thrown instead of a graceful shutdown

```sh
python3 helloworld.py
[2023-02-14 12:23:23 -0700] [6169] [DEBUG] Creating multiprocessing context using 'spawn'
[2023-02-14 12:23:23][DEBUG] Creating multiprocessing context using 'spawn'
[2023-02-14 12:23:23 -0700] [6169] [DEBUG] Starting a process: Sanic-Server-0-0
[2023-02-14 12:23:23][DEBUG] Starting a process: Sanic-Server-0-0
[2023-02-14 12:23:24 -0700] [6175] [DEBUG] Process ack: Sanic-Server-0-0 [6175]
[2023-02-14 12:23:24][DEBUG] Process ack: Sanic-Server-0-0 [6175]
[2023-02-14 12:23:24 -0700] [6175] [INFO] Starting worker [6175]
[2023-02-14 12:23:24][INFO] Starting worker [6175]
^C[2023-02-14 12:23:26 -0700] [6169] [INFO] Received signal SIGINT. Shutting down.
[2023-02-14 12:23:26][INFO] Received signal SIGINT. Shutting down.
[2023-02-14 12:23:26 -0700] [6169] [DEBUG] Terminating a process: Sanic-Server-0-0 [6175]
[2023-02-14 12:23:26][DEBUG] Terminating a process: Sanic-Server-0-0 [6175]
[2023-02-14 12:23:26 -0700] [6169] [INFO] Server Stopped
[2023-02-14 12:23:26][INFO] Server Stopped
Traceback (most recent call last):
  File "/Users/tylerprete/sandbox/asana/asana2/asana/server/kube_app/apps/helloworld/helloworld.py", line 22, in <module>
    app.run(host="127.0.0.1", port=8086, debug=True)
  File "/usr/local/lib/python3.9/site-packages/sanic/mixins/startup.py", line 209, in run
    serve(primary=self)  # type: ignore
  File "/usr/local/lib/python3.9/site-packages/sanic/mixins/startup.py", line 880, in serve
    sock.shutdown(SHUT_RDWR)
OSError: [Errno 57] Socket is not connected
[2023-02-14 12:23:26 -0700] [6175] [INFO] Stopping worker [6175]
[2023-02-14 12:23:26][INFO] Stopping worker [6175]
```

### Code snippet

```python3
from sanic import Sanic
from sanic.response import html, text

app = Sanic("helloworld")

@app.get("/")
def hello_world(request):
    print("Serving /")
    return html("<p>Hello, World!</p>")


if __name__ == "__main__":
    app.run(host="127.0.0.1", port=8086, debug=True)
```

### Expected Behavior

On linux I run this and get the following (removing the sanic banners for brevity):
```sh
python3 helloworld.py
[2023-02-14 19:17:43 +0000] [23570] [DEBUG] Creating multiprocessing context using 'spawn'
[2023-02-14 19:17:43][DEBUG] Creating multiprocessing context using 'spawn'
[2023-02-14 19:17:43 +0000] [23570] [DEBUG] Starting a process: Sanic-Server-0-0
[2023-02-14 19:17:43][DEBUG] Starting a process: Sanic-Server-0-0
[2023-02-14 19:17:43 +0000] [23579] [DEBUG] Process ack: Sanic-Server-0-0 [23579]
[2023-02-14 19:17:43][DEBUG] Process ack: Sanic-Server-0-0 [23579]
[2023-02-14 19:17:43 +0000] [23579] [INFO] Starting worker [23579]
[2023-02-14 19:17:43][INFO] Starting worker [23579]
^C[2023-02-14 19:17:45 +0000] [23570] [INFO] Received signal SIGINT. Shutting down.
[2023-02-14 19:17:45][INFO] Received signal SIGINT. Shutting down.
[2023-02-14 19:17:45 +0000] [23570] [DEBUG] Terminating a process: Sanic-Server-0-0 [23579]
[2023-02-14 19:17:45][DEBUG] Terminating a process: Sanic-Server-0-0 [23579]
[2023-02-14 19:17:45 +0000] [23570] [INFO] Server Stopped
[2023-02-14 19:17:45][INFO] Server Stopped
[2023-02-14 19:17:45 +0000] [23579] [INFO] Stopping worker [23579]
[2023-02-14 19:17:45][INFO] Stopping worker [23579]
```

### How do you run Sanic?

As a script (`app.run` or `Sanic.serve`)

### Operating System

macOS Ventura 13.1

### Sanic Version

22.12.0

### Additional context

_No response_


Discussion:

Resolving patch:
diff --git a/sanic/mixins/startup.py b/sanic/mixins/startup.py
--- a/sanic/mixins/startup.py
+++ b/sanic/mixins/startup.py
@@ -877,7 +877,10 @@ def serve(
 
             sync_manager.shutdown()
             for sock in socks:
-                sock.shutdown(SHUT_RDWR)
+                try:
+                    sock.shutdown(SHUT_RDWR)
+                except OSError:
+                    ...
                 sock.close()
             socks = []
             trigger_events(main_stop, loop, primary)


Test patch: