select-session.py: Pass command name in argument list

When calling os.execpv(), make sure the first argument in the argument
list is the command name so that the command shows up in tools like ps.

Example before:
$ ps -a | grep
  368 pts/4    S+     0:00  -u -2 -f /usr/share/byobu/profiles/tmuxrc new-session -n - /usr/bin/byobu-shell
  784 pts/5    S+     0:00  -2 new-session -t 1 -s _1-784
 8446 pts/3    S+     0:00  -2 new-session -t 1 -s _1-8446

after:
$ ps a
[...]
  368 pts/4    S+     0:00 tmux -u -2 -f /usr/share/byobu/profiles/tmuxrc new-session -n - /usr/bin/byobu-shell
  784 pts/5    S+     0:00 tmux -2 new-session -t 1 -s _1-784
 8446 pts/3    S+     0:00 tmux -2 new-session -t 1 -s _1-8446
This commit is contained in:
Grant Likely 2016-06-16 22:26:04 +01:00
commit 705dbc66ec

View file

@ -130,9 +130,9 @@ def attach_session(session):
cull_zombies(session_name) cull_zombies(session_name)
# must use the binary, not the wrapper! # must use the binary, not the wrapper!
if backend == "tmux": if backend == "tmux":
os.execvp("tmux", ["", "-2", "new-session", "-t", session_name, "-s", "_%s-%i" % (session_name, os.getpid())]) os.execvp("tmux", ["tmux", "-2", "new-session", "-t", session_name, "-s", "_%s-%i" % (session_name, os.getpid())])
else: else:
os.execvp("screen", ["", "-AOxRR", session_name]) os.execvp("screen", ["screen", "-AOxRR", session_name])
sessions = get_sessions() sessions = get_sessions()
@ -180,9 +180,9 @@ if choice >= 1:
if sessions[choice - 1] == "NEW": if sessions[choice - 1] == "NEW":
# Create a new session # Create a new session
if BYOBU_BACKEND == "tmux": if BYOBU_BACKEND == "tmux":
os.execvp("byobu", ["", "new-session", SHELL]) os.execvp("byobu", ["byobu", "new-session", SHELL])
else: else:
os.execvp("byobu", ["", SHELL]) os.execvp("byobu", ["byobu", SHELL])
elif sessions[choice - 1] == "SHELL": elif sessions[choice - 1] == "SHELL":
os.execvp(SHELL, [SHELL]) os.execvp(SHELL, [SHELL])
else: else:
@ -194,4 +194,4 @@ if BYOBU_BACKEND == "tmux":
args = "" args = ""
else: else:
args = "-AOxRR" args = "-AOxRR"
os.execvp("byobu", ["", args]) os.execvp("byobu", ["byobu", args])