[kupfer] Set process title to "kupfer" when starting up
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] Set process title to "kupfer" when starting up
- Date: Mon, 18 Jan 2010 16:37:03 +0000 (UTC)
commit 3d25b4e22a4b09a9889822892f13f5429bad708f
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Mon Jan 18 17:25:48 2010 +0100
Set process title to "kupfer" when starting up
We call into the C Library's prctl to set the process's name (in some
process listings). This function is not available from the python
standard library.
kupfer/main.py | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/main.py b/kupfer/main.py
index 19eb002..3f5f0f5 100644
--- a/kupfer/main.py
+++ b/kupfer/main.py
@@ -129,6 +129,17 @@ def print_banner():
except UnicodeEncodeError, e:
print banner.encode("ascii", "replace")
+def _set_process_title_linux():
+ try:
+ import ctypes
+ except ImportError:
+ return
+ try:
+ libc = ctypes.CDLL("libc.so.6")
+ libc.prctl(15, "kupfer")
+ except (AttributeError, OSError):
+ pass
+
def main():
# parse commandline before importing UI
cli_opts = get_options()
@@ -145,6 +156,7 @@ def main():
except ImportError, e:
pass
sys.excepthook = sys.__excepthook__
+ _set_process_title_linux()
w = browser.WindowController()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]