Fix execution under Python 3
This commit is contained in:
parent
780603027f
commit
e64eaaa97d
@ -1066,13 +1066,14 @@ def fix_xml_all_ampersand(xml_str):
|
|||||||
|
|
||||||
|
|
||||||
def setproctitle(title):
|
def setproctitle(title):
|
||||||
|
assert isinstance(title, type(u''))
|
||||||
try:
|
try:
|
||||||
libc = ctypes.cdll.LoadLibrary("libc.so.6")
|
libc = ctypes.cdll.LoadLibrary("libc.so.6")
|
||||||
except OSError:
|
except OSError:
|
||||||
return
|
return
|
||||||
title = title
|
title = title
|
||||||
buf = ctypes.create_string_buffer(len(title) + 1)
|
buf = ctypes.create_string_buffer(len(title) + 1)
|
||||||
buf.value = title
|
buf.value = title.encode('utf-8')
|
||||||
try:
|
try:
|
||||||
libc.prctl(15, ctypes.byref(buf), 0, 0, 0)
|
libc.prctl(15, ctypes.byref(buf), 0, 0, 0)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
Loading…
Reference in New Issue
Block a user