Skip to content

Instantly share code, notes, and snippets.

@masahide
Created February 17, 2014 01:01
Show Gist options
  • Save masahide/9042946 to your computer and use it in GitHub Desktop.
Save masahide/9042946 to your computer and use it in GitHub Desktop.
if err := session.Run("/usr/bin/scp -qrt ./"); err != nil {
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