chore: debug command

This commit is contained in:
Bo-Yi Wu
2019-09-28 14:52:31 +08:00
parent cfa325a8c4
commit cf9e6f260d
2 changed files with 9 additions and 2 deletions
+8 -2
View File
@@ -202,14 +202,17 @@ func (p *Plugin) Args(target string) []string {
p.Config.TarExec,
"-xf",
p.DestFile,
"-C",
target,
)
if p.Config.StripComponents > 0 {
args = append(args, fmt.Sprintf("-strip-components=%d", p.Config.StripComponents))
}
args = append(args,
"-C",
target,
)
return args
}
@@ -318,6 +321,9 @@ func (p *Plugin) Exec() error {
// untar file
p.log(host, "untar file", p.DestFile)
commamd := strings.Join(p.Args(target), " ")
if p.Config.Debug {
fmt.Println("$", commamd)
}
_, _, _, err = ssh.Run(commamd, p.Config.CommandTimeout)
if err != nil {
+1
View File
@@ -267,6 +267,7 @@ func TestIgnoreList(t *testing.T) {
Target: []string{filepath.Join(u.HomeDir, "ignore")},
CommandTimeout: 60 * time.Second,
TarExec: "tar",
Debug: true,
},
}