Skip to content

Commit 0da5874

Browse files
committed
better exception
1 parent 16424c8 commit 0da5874

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/lcdoc/lp_session.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,22 @@ def tmux_ver_check(checked=[0]):
2929
checked[0] = 1
3030

3131

32-
def init_prompt(n, kw):
32+
def init_prompt(sess_name, kw):
3333
"""run before each command"""
3434
if not is_lprunner[0]:
35-
lp.sprun('tmux send-keys -R -t %s:1' % n) # -R reset terminal state
36-
lp.sprun('tmux clear-history -t %s:1' % n)
37-
lp.sprun("tmux send-keys -t %s:1 '' Enter" % n)
35+
lp.sprun('tmux send-keys -R -t %s:1' % sess_name) # -R reset terminal state
36+
lp.sprun('tmux clear-history -t %s:1' % sess_name)
37+
lp.sprun("tmux send-keys -t %s:1 '' Enter" % sess_name)
38+
p, r = prompt(kw), ''
3839
t0 = now()
39-
p = prompt(kw)
4040
while now() - t0 < 2:
41-
res = lp.sprun('tmux capture-pane -epJS -1000000 -t %s:1' % n)
41+
res = lp.sprun('tmux capture-pane -epJS -1000000 -t %s:1' % sess_name)
4242
r = res.decode('utf-8').rstrip()
4343
if r and (r.endswith(p) or r[-1] in {'#', '$'}):
4444
return
4545
dbg('waiting for prompt...', have=r, want=p)
4646
wait(0.1)
47-
raise Exception('No Prompt; Have so far: %s' % r)
47+
raise Exception('No prompt in session %s; Have so far: %s' % (sess_name, r))
4848

4949

5050
def get_cwd(session_name):

0 commit comments

Comments
 (0)