Name
p:os-exec — The standard p:os-exec step.
Synopsis
The p:os-exec step runs an external command passing the
input that arrives on its source port as standard input,
reading result from standard output, and error
from standard error.
| Input port | Primary | Sequence | Content types |
|---|---|---|---|
| source | ✔ | ✔ | any |
| Output port | Primary | Sequence | Content types |
|---|---|---|---|
| result | ✔ | ✔ | any |
| error | any | ||
| exit-status | application/xml |
| Option name | Type | Default value | Required |
|---|---|---|---|
| command | xs:string | ✔ | |
| args | xs:string* | () | |
| cwd | xs:string? | () | |
| error-content-type | xs:string | 'text/plain' | |
| failure-threshold | xs:integer? | () | |
| path-separator | xs:string? | () | |
| result-content-type | xs:string | 'text/plain' | |
| serialization | map(xs:QName,item()*)? | () |
Declaration
1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" type="p:os-exec">
| <p:input port="source" sequence="true" content-types="any"/>
| <p:output port="result"
| primary="true"
5 | sequence="true"
| content-types="any"/>
| <p:output port="error" content-types="any"/>
| <p:output port="exit-status" content-types="application/xml"/>
| <p:option name="command" required="true" as="xs:string"/>
10 | <p:option name="args" select="()" as="xs:string*"/>
| <p:option name="cwd" as="xs:string?"/>
| <p:option name="result-content-type" select="'text/plain'" as="xs:string"/>
| <p:option name="error-content-type" select="'text/plain'" as="xs:string"/>
| <p:option name="path-separator" as="xs:string?"/>
15 | <p:option name="failure-threshold" as="xs:integer?"/>
| <p:option name="serialization" as="map(xs:QName,item()*)?"/>
|</p:declare-step>Errors
| Code | Description |
|---|---|
err:XC0032 | It is a dynamic error (err:XC0032) if more than
one document appears on the source port of the
p:os-exec step. |
err:XC0033 | It is a dynamic
error (err:XC0033) if the command cannot be run. |
err:XC0034 | It is a dynamic
error (err:XC0034) if the current working directory cannot be changed
to the value of the cwd option. |
err:XC0063 | It is a dynamic
error (err:XC0063) if the path-separator option is
specified and is not exactly one character long. |
err:XC0064 | It is a dynamic
error (err:XC0064) if the exit code from the command is greater than
the specified failure-threshold value. |
Implementation defined features
- If
cwdis not specified, the current working directory is implementation-defined.
Implementation dependent features
- The specific exit status values returned by
a process invoked with
p:os-execare implementation-dependent.
Description
The p:os-exec step is a
standard XProc 3.1 step.
It is also described on XProcRef.org.
Additional examples
The XProc test suite contains examples of the p:os-exec step.