Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait until <condition> to send command (blocking send command) #96

Open
thomasballinger opened this issue Mar 25, 2015 · 7 comments
Open

Comments

@thomasballinger
Copy link
Contributor

I'd find blocking send command functionality useful. So far I've tried waiting for the window title to change back to the shell, waiting for the shell prompt to appear, and waiting for the cursor to move to a new position / the size of the scrollback buffer to increase by a certain amount. Any thoughts on how this could be implemented?

@tony
Copy link
Member

tony commented Mar 25, 2015

@thomasballinger : Are you doing this via Python API (I assume) or config file?

Do you have any report on your progress with these approaches?

@thomasballinger
Copy link
Contributor Author

thomasballinger commented Mar 25, 2015

I've been using the Python api, here's the helper I'm currently using:
https://github.com/thomasballinger/rlundo/blob/master/test/tmux.py#L58

Waiting for the prompt to appear (when it can be predicted) is the approach I'm using now. Checking the window title doesn't seem helpful because we can only poll it and might miss it changing (if it's even guaranteed that it will change).

@tony
Copy link
Member

tony commented Mar 25, 2015

@thomasballinger : Would it be helpful to you if tmuxp would return the process tree of what's underneath a server / session / window / pane?

PID / process name being ready would give you something solid to poll against.

To give you an idea of the data that could be exposed, do pstree -p -a -A | less and search (/ key) for tmux.

@stale
Copy link

stale bot commented Nov 11, 2017

This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.

This bot is used to handle issues where the issue hasn't been discussed or
has gone out of date. If an issue isn't resolved and handled in a certain
period of time, it may be closed. If you would like your issue re-opened,
please create a fresh issue with the latest, up to date information and
mention this issue in it.

@stale stale bot added the stale label Nov 11, 2017
@stale stale bot closed this as completed Nov 19, 2017
@tony tony reopened this Mar 12, 2022
@tony
Copy link
Member

tony commented Mar 19, 2022

@thomasballinger 1.10 has experimental sleep/skip support: https://tmuxp.git-pull.com/history.html#tmuxp-1-10-0-2022-03-19

Not the same as scanning contents and waiting for shell commands to finish, but those can sometimes achieve equivalent outcomes

@thomasballinger
Copy link
Contributor Author

🎉

@tony tony changed the title blocking send command Wait until <condition> to send command (blocking send command) Mar 30, 2022
@categulario
Copy link
Contributor

I just looked at the implementation of wait_for_condition and it mostly overlaps to my proposal in tmux-python/libtmux#372 .

There are some key differences though:

  • retry() requires as only argument a polling function, which has no connection whatsoever with a pane, window or any other libtmux object.
  • wait_for_condition pauses queries with an interval, which I think is a good idea to prevent the processor to going crazy polling if the response is going to take a few milliseconds anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants