Command line handler for REserve. It allows execution and output capturing of command lines.
{
"handlers": {
"cmd": "reserve-cmd"
},
"mappings": [{
"match": "\\/test",
"cmd": "./test.cmd"
}]
}
Capturing group values substitutions can be used, space escaping is done with the character `.
Option | Default Value | Explanation |
---|---|---|
env |
{} |
Additional variables to be used in the created process (see child_process.execFile ) (interpolated) |
html-footer |
'' |
Additional content to be added in the footer of the HTML output (interpolated) |
html-header |
'' |
Additional content to be added in the header of the HTML output (interpolated) |
html-tracking |
false |
Injects JavaScript code to scroll the HTML output while executing |
text-only |
false |
When set, the output is always text |
timeout |
0 |
Automatic kill of the process (see child_process.execFile ) |
NOTE : interpolated values are transformed as described in the custom handlers section of REserve.
Any command can be executed (use it carefully). If a process can not be started, the request ends with a 500
error.
The handler adapts the output based on the accepted mime-type. If text/html
is found in the accept header, the content is formatted to HTML. Otherwise, the output uses text format.