From 1854ad133cd234f98f48feb26ff2003827c134b0 Mon Sep 17 00:00:00 2001 From: Raphael Deem Date: Tue, 4 Apr 2017 13:13:37 -0700 Subject: [PATCH] use socket.set_inheritable instead of os version --- sanic/server.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sanic/server.py b/sanic/server.py index 14ce1ffd..976503a6 100644 --- a/sanic/server.py +++ b/sanic/server.py @@ -5,13 +5,16 @@ import warnings from functools import partial from inspect import isawaitable from multiprocessing import Process -from os import set_inheritable from signal import ( SIGTERM, SIGINT, signal as signal_func, Signals ) -from socket import socket, SOL_SOCKET, SO_REUSEADDR +from socket import ( + socket, + SOL_SOCKET, + SO_REUSEADDR, +) from time import time from httptools import HttpRequestParser @@ -446,7 +449,7 @@ def serve_multiple(server_settings, workers): sock = socket() sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) sock.bind((server_settings['host'], server_settings['port'])) - set_inheritable(sock.fileno(), True) + sock.set_inheritable(True) server_settings['sock'] = sock server_settings['host'] = None server_settings['port'] = None