docs: Add godoc comments to methods for capturing log message output(s)
diff --git a/tfexec/cmd.go b/tfexec/cmd.go index a5f17cb..153667a 100644 --- a/tfexec/cmd.go +++ b/tfexec/cmd.go
@@ -210,6 +210,8 @@ return cmd } +// runTerraformCmdJSON runs a given command that produces a single, static JSON output. +// This is decoded into the provided v argument. func (tf *Terraform) runTerraformCmdJSON(ctx context.Context, cmd *exec.Cmd, v interface{}) error { var outbuf = bytes.Buffer{} cmd.Stdout = mergeWriters(cmd.Stdout, &outbuf) @@ -224,6 +226,8 @@ return dec.Decode(v) } +// runTerraformCmdJSONLog runs a given command that produces multiple, structured JSON log messages. +// Due to this it returns an iterator that allows calling code to consume a stream of messages. func (tf *Terraform) runTerraformCmdJSONLog(ctx context.Context, cmd *exec.Cmd) iter.Seq[NextMessage] { pr, pw := io.Pipe() tf.SetStdout(pw)