@@ -243,22 +243,23 @@ def load_workspace(config_file, args):
243243 builder .build ()
244244
245245 if 'TMUX' in os .environ :
246- if prompt_yes_no ('Already inside TMUX, load session?' ):
247- del os .environ ['TMUX' ]
248- os .execl (tmux_bin , 'tmux' , 'switch-client' , '-t' , sconfig [
249- 'session_name' ])
246+ if prompt_yes_no ('Already inside TMUX, switch to session?' ):
247+ tmux_env = os .environ .pop ('TMUX' )
248+ builder .session .switch_client ()
250249
251- os .execl (tmux_bin , 'tmux' , 'attach-session' , '-t' , sconfig [
252- 'session_name' ])
250+ os .environ ['TMUX' ] = tmux_env
251+ return
252+ else :
253+ sys .exit ('Session created in detached state.' )
254+
255+ builder .session .attach_session ()
253256 except exc .TmuxSessionExists as e :
254257 if prompt_yes_no (e .message + ' Attach?' ):
255- # TODO, do we need os.execl for this?
256258 if 'TMUX' in os .environ :
257- os . execl ( tmux_bin , 'tmux' , 'switch-client' , '-t' ,
258- sconfig [ 'session_name' ])
259+ builder . session . switch_client ()
260+
259261 else :
260- os .execl (tmux_bin , 'tmux' , 'attach-session' , '-t' ,
261- sconfig ['session_name' ])
262+ builder .session .attach_session ()
262263 return
263264 except Exception as e :
264265 logger .error (e )
0 commit comments