Skip to content

Commit 52f5ff3

Browse files
committed
more args.detached conditions.
1 parent 5de471a commit 52f5ff3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tmuxp/cli.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ def load_workspace(config_file, args):
254254
:param type: string
255255
256256
"""
257-
logger.info('Loading %s.' % config_file)
258257

259258
sconfig = kaptan.Kaptan()
260259
sconfig = sconfig.import_config(config_file).get()
@@ -276,12 +275,13 @@ def load_workspace(config_file, args):
276275
tmux_bin = util.which('tmux')
277276

278277
try:
278+
logger.info('Loading %s.' % config_file)
279279
builder.build()
280280

281281
if 'TMUX' in os.environ:
282-
if args.answer_yes or prompt_yes_no(
282+
if not args.detached and (args.answer_yes or prompt_yes_no(
283283
'Already inside TMUX, switch to session?'
284-
):
284+
)):
285285
tmux_env = os.environ.pop('TMUX')
286286
builder.session.switch_client()
287287

@@ -293,7 +293,9 @@ def load_workspace(config_file, args):
293293
if not args.detached:
294294
builder.session.attach_session()
295295
except exc.TmuxSessionExists as e:
296-
if args.answer_yes or prompt_yes_no('%s Attach?' % e):
296+
if not args.detached and (
297+
args.answer_yes or prompt_yes_no('%s Attach?' % e)
298+
):
297299
if 'TMUX' in os.environ:
298300
builder.session.switch_client()
299301

0 commit comments

Comments
 (0)