Go for DevOps
You're viewing a free preview. Sign in free to read every script.
Why this exists DevOps tools often call other tools: git, kubectl, docker, terraform. os/exec does this without a shell, which is both faster and much safer, but it has details worth knowing: timeouts, exit codes versus…
Running External Commands Safely with os/exec
Run other programs from Go with a timeout, capture standard output and error separately, read the exit code, and stream output line by line. Explains why you pass arguments separately instead of building a shell command.
Sign in free to read this script, along with the rest of the library.
Sign in free