Skip to content

Commit 8b98d08

Browse files
author
Xuewei Zhang
committed
Record scp command failure message to help debugging
1 parent dd37dfe commit 8b98d08

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/e2e/lib/gce/instance.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,13 @@ func (ins *Instance) PushFile(srcPath, destPath string) error {
159159
if ins.ExternalIP == "" {
160160
ins.populateExternalIP()
161161
}
162-
return exec.Command("scp", "-o", "StrictHostKeyChecking no",
162+
output, err := exec.Command("scp", "-o", "StrictHostKeyChecking no",
163163
"-i", ins.SshKey,
164-
srcPath, fmt.Sprintf("%s@%s:%s", ins.SshUser, ins.ExternalIP, destPath)).Run()
164+
srcPath, fmt.Sprintf("%s@%s:%s", ins.SshUser, ins.ExternalIP, destPath)).CombinedOutput()
165+
if err != nil {
166+
return fmt.Errorf("Error running scp: %v.\nHere is the output for the command: %v", err, string(output))
167+
}
168+
return nil
165169
}
166170

167171
// DeleteInstance deletes a GCE instance.

0 commit comments

Comments
 (0)