Semantics : ExecStatement

ExecStatement  ::=  exec ( < IDENTIFIER > )? Expr ( from Expr )?
( with ( Expr | ( IDENTIFIER = Expr ),+ )
( ( needSystemIn )? ( ; | output SimpleBlock )
| input SimpleBlock ( output SimpleBlock )?
)

Used by:  

This statement executes an external command-line, with many options. The command-line may contain multiple programs with output of the previous programs piped into the following ones. Each program can take one input and may produce an output sream and an error stream.

You can specify the working directory this command-line is started with by the from clause, and/or the environment variables fot the new process using the with clause, which can be a series of name=value pairs, or an expression that is a Properties or Struct .

The input clause allows script code to write input to the command-line. Or, if needSystemIn is specified, the input stream of the command-line is connected to the system input stream. Otherwise, unless there is an input redirect or a input clause, the command-line is assumed not taking input.

The script can also receive output of the command-line by the output clause. The output is read by system function readPipe().

If both input and output clauses are present, the output clause is executed in a second thread; the input block, however, stays in the main thread.