Browse Source

[utils] Simplify setproctitle

master
Philipp Hagemeister 10 years ago
parent
commit
6eefe53329
1 changed files with 4 additions and 4 deletions
  1. 8
      youtube_dl/utils.py

8
youtube_dl/utils.py

@ -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

Loading…
Cancel
Save