spudplate
Template scaffolding compiler for spudlang .spud files
Loading...
Searching...
No Matches
spudplate::RunStmt Struct Reference

A run statement - executes a shell command after user authorisation. More...

#include <ast.h>

Public Attributes

ExprPtr command
 Expression whose string value is the command.
 
std::optional< PathExprcwd
 Optional in <path> working directory.
 
std::optional< ExprPtr > timeout
 Optional timeout <int> override in seconds. Absent means use the run-time default unless --no-timeout is set.
 
std::optional< ExprPtr > when_clause
 Optional condition guarding execution.
 
int line
 1-based source line where this node begins.
 
int column
 1-based source column where this node begins.
 

Detailed Description

A run statement - executes a shell command after user authorisation.

Example: run "git init" in {dir} when use_git

The command expression is evaluated to a string at runtime and dispatched via /bin/sh -c. The optional in <path> clause pins the working directory for the command - without it, the command inherits the cwd of the spudplate process. Each spudplate run invocation prompts the user once, up front, listing every literal command (and its in <path>, if any) before any statement executes; declining aborts cleanly with no side effects.