mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 16:29:21 +00:00
fix nil pointer in addons test
This commit is contained in:
parent
3a15a374ba
commit
00144659ec
@ -399,16 +399,17 @@ func writeRemoteFile(sshClient *ssh.Client, data, dir, fileName string, mode os.
|
||||
defer session.Close()
|
||||
|
||||
fileSize := len(data)
|
||||
go func() {
|
||||
// ignore errors here. scp whould return errors if something goes wrong.
|
||||
pipe, _ := session.StdinPipe()
|
||||
defer pipe.Close()
|
||||
fmt.Fprintf(pipe, "C%#o %d %s\n", mode, fileSize, fileName)
|
||||
io.Copy(pipe, strings.NewReader(data))
|
||||
fmt.Fprint(pipe, "\x00")
|
||||
}()
|
||||
if err := session.Run(fmt.Sprintf("scp -t %s", dir)); err != nil {
|
||||
pipe, err := session.StdinPipe()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
defer pipe.Close()
|
||||
if err := session.Start(fmt.Sprintf("scp -t %s", dir)); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintf(pipe, "C%#o %d %s\n", mode, fileSize, fileName)
|
||||
io.Copy(pipe, strings.NewReader(data))
|
||||
fmt.Fprint(pipe, "\x00")
|
||||
pipe.Close()
|
||||
return session.Wait()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user