Eventum Logo

Eventum

Eventtemplate

Subprocess

Execute shell commands from Jinja2 templates.

The subprocess variable lets you execute shell commands from templates.

ParameterTypeDefaultDescription
commandstringShell command to execute.
cwdstringNoneWorking directory.
envmappingNoneEnvironment variables.
timeoutfloatNoneTimeout in seconds.

The run method returns a result object with three fields:

FieldTypeDescription
stdoutstringStandard output (decoded as UTF-8).
stderrstringStandard error (decoded as UTF-8).
exit_codeintProcess exit code.
{%- set result = subprocess.run('hostname', timeout=5.0) -%}
{{ result.stdout | trim }}

Subprocess calls run synchronously and block event production. Use short timeouts to avoid stalling the pipeline.