1
0
mirror of https://github.com/l1ving/youtube-dl synced 2024-11-20 19:42:59 +08:00

[utils] Simplify setproctitle

This commit is contained in:
Philipp Hagemeister 2014-03-23 14:28:22 +01:00
parent 1986025d2b
commit 6eefe53329

View File

@ -1126,11 +1126,11 @@ def setproctitle(title):
libc = ctypes.cdll.LoadLibrary("libc.so.6")
except OSError:
return
title = title
buf = ctypes.create_string_buffer(len(title) + 1)
buf.value = title.encode('utf-8')
title_bytes = title.encode('utf-8')
buf = ctypes.create_string_buffer(len(title_bytes))
buf.value = title_bytes
try:
libc.prctl(15, ctypes.byref(buf), 0, 0, 0)
libc.prctl(15, buf, 0, 0, 0)
except AttributeError:
return # Strange libc, just skip this