Call a system command and get output.
Commands may be invoked in one of two ways; either with the args
attribute, which should be a list, or with the shell
attribute which should be a string to be passed to the shell. For example, the following two calls are equivalent:
<system-call shell="ls -al"/>
<system-call args="['ls', '-al']"/>
The args
form is preferred because shell
is a potential security risk; if you don't escape parameters retrieved from a request it may be possible for a malicious use to execute code on your server.
If the process returns a non-zero error code, then a system-call.process-error
exception is thrown. The info
value of the exception will contain code
and output
.
<system-call shell="ls -al" console="yes"/>
name | purpose | type | required? | default | choices |
---|---|---|---|---|---|
args |
call arguments | expression | No | None |
|
console |
write output to the console? | boolean | No | no |
|
log |
write output to this log | text | No | ||
output |
Destination for output | reference | No | ||
shell |
shell command | text | No |
name | purpose | type | required? | default | choices |
---|---|---|---|---|---|
dst |
Destination | reference | No | ||
if |
Conditional expression | expression | No | yes |
|
value |
Value | expression | No | None |