mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-24 19:30:15 +00:00
Set process name to match application using setproctitle
Using the setproctitle module the process name displayed in top and other places will correctly reflect the binary name. This is an optional dependency
This commit is contained in:
parent
0676aaf918
commit
1058435700
3 changed files with 20 additions and 1 deletions
|
@ -7,6 +7,7 @@
|
||||||
* #2021: Fix share ratio limit not obeyed for seeded torrents added to session
|
* #2021: Fix share ratio limit not obeyed for seeded torrents added to session
|
||||||
* Add optparse custom version to prevent unnecessary loading of libtorrent
|
* Add optparse custom version to prevent unnecessary loading of libtorrent
|
||||||
* #1554: Fix seeding on share ratio failing for partially selected torrents
|
* #1554: Fix seeding on share ratio failing for partially selected torrents
|
||||||
|
* Add proper process title naming in ps, top etc. (Depends: setproctitle)
|
||||||
|
|
||||||
==== GtkUI ====
|
==== GtkUI ====
|
||||||
* #1918: Fix Drag'n'Drop not working in Windows
|
* #1918: Fix Drag'n'Drop not working in Windows
|
||||||
|
|
|
@ -47,6 +47,12 @@ import pkg_resources
|
||||||
import gtk, gtk.glade
|
import gtk, gtk.glade
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
try:
|
||||||
|
from setproctitle import setproctitle, getproctitle
|
||||||
|
except ImportError:
|
||||||
|
setproctitle = lambda t: None
|
||||||
|
getproctitle = lambda: None
|
||||||
|
|
||||||
# Initialize gettext
|
# Initialize gettext
|
||||||
try:
|
try:
|
||||||
locale.setlocale(locale.LC_ALL, '')
|
locale.setlocale(locale.LC_ALL, '')
|
||||||
|
@ -190,6 +196,9 @@ class GtkUI(object):
|
||||||
return 1
|
return 1
|
||||||
SetConsoleCtrlHandler(win_handler)
|
SetConsoleCtrlHandler(win_handler)
|
||||||
|
|
||||||
|
# Set process name again to fix gtk issue
|
||||||
|
setproctitle(getproctitle())
|
||||||
|
|
||||||
# Attempt to register a magnet URI handler with gconf, but do not overwrite
|
# Attempt to register a magnet URI handler with gconf, but do not overwrite
|
||||||
# if already set by another program.
|
# if already set by another program.
|
||||||
common.associate_magnet_links(False)
|
common.associate_magnet_links(False)
|
||||||
|
|
|
@ -41,6 +41,11 @@ import deluge.common
|
||||||
import deluge.configmanager
|
import deluge.configmanager
|
||||||
import deluge.log
|
import deluge.log
|
||||||
|
|
||||||
|
try:
|
||||||
|
from setproctitle import setproctitle
|
||||||
|
except ImportError:
|
||||||
|
setproctitle = lambda t: None
|
||||||
|
|
||||||
def version_callback(option, opt_str, value, parser):
|
def version_callback(option, opt_str, value, parser):
|
||||||
print os.path.basename(sys.argv[0]) + ": " + deluge.common.get_version()
|
print os.path.basename(sys.argv[0]) + ": " + deluge.common.get_version()
|
||||||
try:
|
try:
|
||||||
|
@ -111,10 +116,12 @@ class _UI(object):
|
||||||
log.error("There was an error setting the config dir! Exiting..")
|
log.error("There was an error setting the config dir! Exiting..")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
setproctitle("deluge-%s" % self.__name)
|
||||||
|
|
||||||
log.info("Deluge ui %s", deluge.common.get_version())
|
log.info("Deluge ui %s", deluge.common.get_version())
|
||||||
log.debug("options: %s", self.__options)
|
log.debug("options: %s", self.__options)
|
||||||
log.debug("args: %s", self.__args)
|
log.debug("args: %s", self.__args)
|
||||||
log.info("Starting ui..")
|
log.info("Starting %s ui..", self.__name)
|
||||||
|
|
||||||
class UI:
|
class UI:
|
||||||
def __init__(self, options, args, ui_args):
|
def __init__(self, options, args, ui_args):
|
||||||
|
@ -131,6 +138,8 @@ class UI:
|
||||||
else:
|
else:
|
||||||
selected_ui = options.ui
|
selected_ui = options.ui
|
||||||
|
|
||||||
|
setproctitle("deluge")
|
||||||
|
|
||||||
config.save()
|
config.save()
|
||||||
del config
|
del config
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue