|
|
@ -152,7 +152,7 @@ def setProcessName(executableName): |
|
|
|
"""From |
|
|
|
https://stackoverflow.com/questions/31132342/change-process-name-while-executing-a-python-script |
|
|
|
""" |
|
|
|
import ctypes |
|
|
|
import ctypes, ctypes.util |
|
|
|
lib = ctypes.cdll.LoadLibrary(None) |
|
|
|
prctl = lib.prctl |
|
|
|
prctl.restype = ctypes.c_int |
|
|
@ -164,6 +164,28 @@ def setProcessName(executableName): |
|
|
|
raise OSError("prctl result: %d" % result) |
|
|
|
set_proctitle(executableName.encode()) |
|
|
|
|
|
|
|
|
|
|
|
libpthread_path = ctypes.util.find_library("pthread") |
|
|
|
if not libpthread_path: |
|
|
|
return |
|
|
|
|
|
|
|
libpthread = ctypes.CDLL(libpthread_path) |
|
|
|
if hasattr(libpthread, "pthread_setname_np"): |
|
|
|
_pthread_setname_np = libpthread.pthread_setname_np |
|
|
|
|
|
|
|
_pthread_self = libpthread.pthread_self |
|
|
|
_pthread_self.argtypes = [] |
|
|
|
_pthread_self.restype = ctypes.c_void_p |
|
|
|
|
|
|
|
_pthread_setname_np.argtypes = [ctypes.c_void_p, ctypes.c_char_p] |
|
|
|
_pthread_setname_np.restype = ctypes.c_int |
|
|
|
|
|
|
|
if _pthread_setname_np is None: |
|
|
|
return |
|
|
|
|
|
|
|
_pthread_setname_np(_pthread_self(), executableName.encode()) |
|
|
|
|
|
|
|
|
|
|
|
def _is_jack_running(): |
|
|
|
"""Check for JACK""" |
|
|
|
import ctypes |
|
|
@ -195,7 +217,12 @@ def checkJackOrExit(prettyName): |
|
|
|
|
|
|
|
|
|
|
|
checkJackOrExit(METADATA["name"]) |
|
|
|
setProcessName(METADATA["shortName"]) |
|
|
|
|
|
|
|
try: |
|
|
|
#Only cosmetics |
|
|
|
setProcessName(METADATA["shortName"]) |
|
|
|
except: |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
#Catch Exceptions even if PyQt crashes. |
|
|
|