| 1 |
! $Id: wait,v 1.5 2004-10-01 17:09:57 f Exp $ |
| 2 |
! |
| 3 |
! Copyright (c) 1990-2001 Michael Sandrof, Troy Rollo, Matthew Green, |
| 4 |
! and other ircII contributors. |
| 5 |
! |
| 6 |
! All rights reserved. See the HELP SCROLLZ COPYRIGHT file for more |
| 7 |
! information. |
| 8 |
! |
| 9 |
Usage: WAIT [%process] [-cmd [%process] <command> <do_command>] |
| 10 |
There are several forms of this command. The first, and best is: |
| 11 |
WAIT -CMD command |
| 12 |
|
| 13 |
WAIT causes the command to be executed when server output |
| 14 |
that hasn't yet arrived, finally arrives. This allows you to |
| 15 |
take a specific action immediately after receiving output from |
| 16 |
the server, or client. |
| 17 |
|
| 18 |
For example, the following alias: |
| 19 |
ALIAS BACKWARDS wait -cmd echo hello there;echo hi there |
| 20 |
will actually display "hi there" before "hello there", because |
| 21 |
the "hello there" echo is not executed until a WAIT token is |
| 22 |
received from the server. If for instance you wanted to make |
| 23 |
sure to execute some command after the completion of a TRACE |
| 24 |
of your server, the format would be. |
| 25 |
TRACE |
| 26 |
WAIT -CMD command |
| 27 |
Note: This doesn't work for commands that depend on another server to |
| 28 |
send you information. TRACE <remote server> for instance. |
| 29 |
|
| 30 |
The second form of the command is: |
| 31 |
WAIT -CMD %process command |
| 32 |
Where %process is a valid running processes id or name. This is |
| 33 |
used to cause ScrollZ to execute the command after the process has |
| 34 |
exited. If the given process doesn't exist, return is immediate. |
| 35 |
Here is an example of it's use: |
| 36 |
alias uptime { |
| 37 |
exec -name uptime uptime |
| 38 |
wait -cmd %uptime eval echo The time is $uptime |
| 39 |
} |
| 40 |
alias dotime uptime |
| 41 |
on ^exec uptime assign uptime $1 |
| 42 |
When dotime is called, a request will be sent to get the uptime. |
| 43 |
The ON EXEC will catch the time and assign it to the variable |
| 44 |
'uptime' at the same time that the alias is at the 'wait %uptime' |
| 45 |
stage, when the process exits, WAIT will continue and execute |
| 46 |
echo The time is $uptime, where '$uptime' has been set already. |
| 47 |
|
| 48 |
If you are echoing output to the screen from within the WAIT -CMD |
| 49 |
form, it is probably a good idea to record the current window |
| 50 |
and use XECHO -WINDOW to ensure that output goes where it should. |
| 51 |
|
| 52 |
The last form of WAIT is no longer recommended. It can be |
| 53 |
used in the form of |
| 54 |
WAIT |
| 55 |
or |
| 56 |
WAIT %process |
| 57 |
|
| 58 |
This suspends he client until the server has finished output, and |
| 59 |
has innumerable problems, among them being: |
| 60 |
|
| 61 |
- If one WAIT is executed while another is pending, |
| 62 |
both will be registered as satisfied when the first |
| 63 |
returns. A warning is now issued when this happens. |
| 64 |
|
| 65 |
- If you are in a prompted input sequence (such as oper |
| 66 |
password, confirmation prompts, and $".." input), |
| 67 |
results can be unpredictable. |
| 68 |
|
| 69 |
- It is not consistant with the message driven programming |
| 70 |
model which exists in ScrollZ. |
| 71 |
|
| 72 |
With multi window enhancements the problems with WAIT become even |
| 73 |
more prohibitive, unless used in the -CMD form. |