File tree 1 file changed +16
-5
lines changed
1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -371,19 +371,30 @@ def send_keys(
371
371
372
372
Examples
373
373
--------
374
- >>> pane = window.split(shell='sh')
374
+ >>> import shutil
375
+ >>> pane = window.split(
376
+ ... shell=f"{shutil.which('env')} PROMPT_COMMAND='' PS1='READY>' sh")
377
+ >>> from libtmux.test.retry import retry_until
378
+ >>> def wait_for_prompt() -> bool:
379
+ ... try:
380
+ ... pane_contents = "\n".join(pane.capture_pane())
381
+ ... return "READY>" in pane_contents and len(pane_contents.strip()) > 0
382
+ ... except Exception:
383
+ ... return False
384
+ >>> retry_until(wait_for_prompt, 2, raises=True)
385
+ True
375
386
>>> pane.capture_pane()
376
- ['$ ']
387
+ ['READY> ']
377
388
378
389
>>> pane.send_keys('echo "Hello world"', enter=True)
379
390
380
391
>>> pane.capture_pane()
381
- ['$ echo "Hello world"', 'Hello world', '$ ']
392
+ ['READY> echo "Hello world"', 'Hello world', 'READY> ']
382
393
383
394
>>> print('\n'.join(pane.capture_pane())) # doctest: +NORMALIZE_WHITESPACE
384
- $ echo "Hello world"
395
+ READY> echo "Hello world"
385
396
Hello world
386
- $
397
+ READY>
387
398
"""
388
399
prefix = " " if suppress_history else ""
389
400
You can’t perform that action at this time.
0 commit comments