From 40eedd012d9bfd1910cc5bb834bb790ac7dfba2a Mon Sep 17 00:00:00 2001 From: Neil Williams Date: Fri, 10 Jun 2011 19:48:25 -0700 Subject: [PATCH] Add --proctitle to paster run. When the setproctitle module is available and --proctitle is passed, paster run will set the process title (as seen by ps, top, etc.) to the specified value. --- r2/r2/commands.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/r2/r2/commands.py b/r2/r2/commands.py index 5afd7f109..f87c7e7f1 100644 --- a/r2/r2/commands.py +++ b/r2/r2/commands.py @@ -49,8 +49,18 @@ class RunCommand(command.Command): parser.add_option('-c', '--command', dest='command', help="execute command in module") + parser.add_option("", "--proctitle", + dest="proctitle", + help="set the title seen by ps and top") def command(self): + try: + if self.options.proctitle: + import setproctitle + setproctitle.setproctitle("paster " + self.options.proctitle) + except ImportError: + pass + here_dir = os.getcwd() if self.args[0].lower() == 'standalone':