cmd 3plumb 2012-08-31

NAME

cmd - plumb script parser / command execution

SYNPOSIS

[cmd]

 
               +-----+
0 (stdin) ---->| cmd |---> (stdout) 1
               +-----+

DESCRIPTION

Cmd reads a plumb script on its stdin, parses it and executes the transactions. Unlike with -f or command line scripts, end-of-file is not an implicit flush, but a discard of the current transaction. The flush command shall be used explicitly to execute each transaction. A single instance of cmd accepts multiple subsequent transactions.

Result of query commands is written on stdout of [cmd].

It is possible to run multiple instances of [cmd] in parallel and it is guaranteed that transactions will not get mixed.

eof handling

Default; an unfinished transaction on the input is discarded on eof.

blocking/flow control

No blocking is possible.

buffering

Transaction buffering; read and parse the script compiling it to a binary transaction format; store the binary in a transaction buffer. Transaction buffer can be executed and cleared by the flush command or discarded by an eof.

EXAMPLE

The most common use of [cmd] is to change project states on the fly:
 
	event:* | {awk -f watchdog.awk} | [cmd]
The awk script should emit transactions like this:
 
query proc.state anim
flush

# some time passes

query proc.state anim
flush

# some time passes

pause ai
pause logger
flush

# some time passes

query proc.state anim
flush

# some time passes
resume ai
resume logger
flush

TODO: single-script example of a delayed startup of processes

SEE ALSO

cmd 3plumb 2012-08-31