Created
February 17, 2014 01:01
-
-
Save masahide/9042946 to your computer and use it in GitHub Desktop.
golangでscp ref: http://qiita.com/yamasaki-masahide/items/56bea80dd8a044e0ac4b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if err := session.Run("/usr/bin/scp -qrt ./"); err != nil { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| go func() { | |
| w, _ := session.StdinPipe() | |
| defer w.Close() | |
| content := "123456789\n" | |
| fmt.Fprintln(w, "C0644", len(content), "testfile") | |
| fmt.Fprint(w, content) | |
| fmt.Fprint(w, "\x00") // 传输以\x00结束 | |
| }() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment