This commit is contained in:
@@ -42,7 +42,7 @@ __all__ = (
|
||||
'DaemonContext', 'detached', 'parse_uid', 'parse_gid', 'setgroups',
|
||||
'initgroups', 'setgid', 'setuid', 'maybe_drop_privileges', 'signals',
|
||||
'signal_name', 'set_process_title', 'set_mp_process_title',
|
||||
'get_errno_name', 'ignore_errno', 'fd_by_path', 'isatty',
|
||||
'get_errno_name', 'ignore_errno', 'fd_by_path',
|
||||
)
|
||||
|
||||
# exitcodes
|
||||
@@ -95,14 +95,6 @@ SIGNAMES = {
|
||||
SIGMAP = {getattr(_signal, name): name for name in SIGNAMES}
|
||||
|
||||
|
||||
def isatty(fh):
|
||||
"""Return true if the process has a controlling terminal."""
|
||||
try:
|
||||
return fh.isatty()
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
||||
def pyimplementation():
|
||||
"""Return string identifying the current Python implementation."""
|
||||
if hasattr(_platform, 'python_implementation'):
|
||||
@@ -194,14 +186,10 @@ class Pidfile:
|
||||
if not pid:
|
||||
self.remove()
|
||||
return True
|
||||
if pid == os.getpid():
|
||||
# this can be common in k8s pod with PID of 1 - don't kill
|
||||
self.remove()
|
||||
return True
|
||||
|
||||
try:
|
||||
os.kill(pid, 0)
|
||||
except OSError as exc:
|
||||
except os.error as exc:
|
||||
if exc.errno == errno.ESRCH or exc.errno == errno.EPERM:
|
||||
print('Stale pidfile exists - Removing it.', file=sys.stderr)
|
||||
self.remove()
|
||||
|
||||
Reference in New Issue
Block a user