Merge pull request #11748 from zexi/ansibleserver-tmp-cmd

feat(ansibleserver): record running cmd to debug
This commit is contained in:
Zexi Li
2021-07-29 16:40:03 +08:00
committed by GitHub
+3
View File
@@ -21,6 +21,7 @@ import (
"io/ioutil"
"os"
"os/exec"
"path"
"path/filepath"
"sync"
@@ -205,6 +206,8 @@ func (r runnable) Run(ctx context.Context) (err error) {
cmd.Dir = tmpdir
cmd.Env = os.Environ()
cmd.Env = append(cmd.Env, "ANSIBLE_HOST_KEY_CHECKING=False")
// for debug
ioutil.WriteFile(path.Join(tmpdir, "run_cmd"), []byte(cmd.String()), os.ModePerm)
stdout, _ := cmd.StdoutPipe()
stderr, _ := cmd.StderrPipe()
if err1 := cmd.Start(); err1 != nil {