set process title

This commit is contained in:
Anthony Scopatz 2016-01-27 18:47:17 -05:00
parent 60c2b783fe
commit 77109e6dd7
3 changed files with 10 additions and 0 deletions

View file

@ -11,6 +11,8 @@ Current Developments
and a subprocess command exits with a non-zero return code, a
CalledProcessError will be raised. This is useful in scripts that should
fail at the first error.
* If the ``setproctitle`` package is installed, the process title will be
set to ``'xonsh'`` rather than the path to the Python interpreter.
**Changed:** None

View file

@ -232,6 +232,7 @@ Xonsh currently has the following external dependencies,
#. PLY
#. prompt-toolkit (optional)
#. Jupyter (optional)
#. setproctitle (optional)
*Documentation:*

View file

@ -6,6 +6,11 @@ import builtins
from argparse import ArgumentParser, ArgumentTypeError
from contextlib import contextmanager
try:
from setproctitle import setproctitle
except ImportError:
setproctitle = None
from xonsh import __version__
from xonsh.shell import Shell
from xonsh.pretty import pprint
@ -124,6 +129,8 @@ def _pprint_displayhook(value):
def premain(argv=None):
"""Setup for main xonsh entry point, returns parsed arguments."""
if setproctitle is not None:
setproctitle('xonsh')
args, other = parser.parse_known_args(argv)
if args.file is not None:
real_argv = (argv or sys.argv)