#NEWLINE# def command_kill_session( args ) : #NEWLINE# #INDENT# 'Command to kill a tmux session.' #NEWLINE# commands = [ ] #NEWLINE# ctext = ' ' . join ( args . session_name ) #NEWLINE# t = Server ( socket_name = ( args . socket_name or None ) , socket_path = ( args . socket_path or None ) ) #NEWLINE# try : #NEWLINE# #INDENT# session = next ( ( commands for s in t . sessions if ( s . get ( 'session_name' ) == ctext ) ) , None ) #NEWLINE# if ( not session ) : #NEWLINE# #INDENT# raise exc . TmuxpException ( 'Session not found.' ) #NEWLINE# #UNINDENT# #UNINDENT# except exc . TmuxpException as e : #NEWLINE# #INDENT# print ( e ) #NEWLINE# return #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# session . kill_session ( ) #NEWLINE# print ( ( 'Killed session %s.' % ctext ) ) #NEWLINE# #UNINDENT# except exc . TmuxpException as e : #NEWLINE# #INDENT# logger . error ( e )