Add a command queue to standardize and simplify commands that call other

commands and allow a command to block execution of subsequent commands. This
allows run-shell and if-shell to be synchronous which has been much requested.

Each client has a default command queue and commands are consumed one at a time
from it. A command may suspend execution from the queue by returning
CMD_RETURN_WAIT and then resume it by calling cmd_continue() - for example
run-shell does this from the callback that is fired after the job is freed.

When the command queue becomes empty, command clients are automatically exited
(unless attaching). A callback is also fired - this is used for nested commands
in, for example, if-shell which can block execution of the client's cmdq until
a new cmdq becomes empty.

Also merge all the old error/info/print functions together and lose the old
curclient/cmdclient distinction - a cmdq is bound to one client (or none if in
the configuration file), this is a command client if c->session is NULL
otherwise an attached client.
This commit is contained in:
Nicholas Marriott
2013-02-23 22:25:58 +00:00
parent 357da035b9
commit 3964309c67
86 changed files with 1218 additions and 1219 deletions

16
tmux.1
View File

@ -3468,7 +3468,11 @@ Miscellaneous commands are as follows:
.Bl -tag -width Ds
.It Ic clock-mode Op Fl t Ar target-pane
Display a large clock.
.It Ic if-shell Ar shell-command command Op Ar command
.It Xo Ic if-shell
.Op Fl b
.Ar shell-command command
.Op Ar command
.Xc
.D1 (alias: Ic if )
Execute the first
.Ar command
@ -3477,19 +3481,27 @@ if
returns success or the second
.Ar command
otherwise.
With
.Fl b ,
.Ar shell-command
is run in the background.
.It Ic lock-server
.D1 (alias: Ic lock )
Lock each client individually by running the command specified by the
.Ic lock-command
option.
.It Xo Ic run-shell
.Fl b
.Op Fl t Ar target-pane
.Ar shell-command
.Xc
.D1 (alias: Ic run )
Execute
.Ar shell-command
in the background without creating a window.
without creating a window.
With
.Fl b ,
the command is run in the background.
After it finishes, any output to stdout is displayed in copy mode (in the pane
specified by
.Fl t