From e5d0d3bea8bddaf468b0692e58aec82b5c04285b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 28 Mar 2014 05:12:02 +0100 Subject: set process title MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/__main__.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src') diff --git a/src/__main__.py b/src/__main__.py index 6490652..287a142 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -29,6 +29,29 @@ PROGRAM_NAME = 'blueshift' PROGRAM_VERSION = '1.15' +## Set process title +def setproctitle(title): + ''' + Set process title + + @param title:str The title of the process + ''' + import ctypes + try: + title = title.encode(sys.getdefaultencoding(), 'replace') + title = ctypes.create_string_buffer(title) + if 'linux' in sys.platform: + libc = ctypes.cdll.LoadLibrary("libc.so.6") + libc.prctl(15, ctypes.byref(title), 0, 0, 0) + elif 'bsd' in sys.platform: + libc = ctypes.cdll.LoadLibrary("libc.so.7") + libc.setproctitle(ctypes.create_string_buffer(b'-%s'), title) + except: + pass +setproctitle(sys.argv[0]) + + + ## Set global variables global DATADIR, i_size, o_size, r_curve, g_curve, b_curve, clip_result, reset, panicgate global periodically, wait_period, fadein_time, fadeout_time, fadein_steps, fadeout_steps -- cgit v1.2.3-70-g09d2