Skip to content

Commit 9e90a8a

Browse files
committed
Fix -v bug for subparsers. Fix attach-session and kill-session bug if no server runnings
1 parent c635815 commit 9e90a8a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tmuxp/cli.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ def subcommand_attach_session(args):
245245
except IndexError as e:
246246
print('Session not found.')
247247
return
248+
except Exception as e:
249+
print(e.message[0])
250+
return
248251

249252
if 'TMUX' in os.environ:
250253
del os.environ['TMUX']
@@ -260,7 +263,11 @@ def subcommand_kill_session(args):
260263
ctext = args.session_name[0]
261264

262265
t = Server()
263-
sessions = [s for s in t.sessions if s.get('session_name') == ctext]
266+
try:
267+
sessions = [s for s in t.sessions if s.get('session_name') == ctext]
268+
except Exception as e:
269+
print(e.message[0])
270+
return
264271

265272
if (len(sessions) == 1):
266273
try:
@@ -379,10 +386,7 @@ def main():
379386

380387
util.oh_my_zsh_auto_title()
381388

382-
print (args)
383-
if args.version:
384-
print('tmuxp %s' % __version__)
385-
elif args.callback is subcommand_load:
389+
if args.callback is subcommand_load:
386390
subcommand_load(args)
387391
elif args.callback is subcommand_convert:
388392
subcommand_convert(args)

0 commit comments

Comments
 (0)