Documentation
¶
Index ¶
Constants ¶
const DefaultTimeout = 30 * time.Second
DefaultTimeout is the default timeout for command execution (30 seconds)
Variables ¶
This section is empty.
Functions ¶
func IsSameWeek ¶
IsSameWeek returns true if both dates are in the same week (Monday-Sunday)
Types ¶
type CommandResult ¶
CommandResult holds the result of a command execution
func ExecuteCommand ¶
func ExecuteCommand(cfg ExecConfig) CommandResult
ExecuteCommand executes a command with timeout and captures output
func ExecuteShellCommand ¶
func ExecuteShellCommand(cmd string, timeout time.Duration) CommandResult
ExecuteShellCommand executes a shell command string (using sh -c).
SECURITY WARNING: This function executes commands through a shell, which means the command string can contain shell metacharacters (pipes, redirects, etc.). The caller MUST ensure that the command string comes from a trusted source (e.g., configuration files with appropriate file permissions) and MUST validate any user-provided input that is substituted into the command.
Example of safe usage:
- Command from trusted config file: ✓ Safe
- Command with validated date substitution: ✓ Safe (if date format is validated)
- Command with arbitrary user input: ✗ UNSAFE (command injection risk)