1
0
mirror of https://github.com/schollz/croc.git synced 2025-01-06 05:13:02 +03:00
This commit is contained in:
Zack Scholl 2018-07-01 14:41:58 -07:00
parent 909e82323d
commit d255f3bba0

View File

@ -139,15 +139,19 @@ func (c *Croc) client(role int, channel string) (err error) {
if c.cs.channel.fileMetaData.IsDir {
folderOrFile = "folder"
}
fmt.Fprintf(os.Stderr, "\nReceived %s written to %s", folderOrFile, c.cs.channel.fileMetaData.Name)
// push to stdout if required
if c.Stdout && !c.cs.channel.fileMetaData.IsDir {
fmt.Fprintf(os.Stderr, "\nReceived %s written to %s", folderOrFile, "stdout")
var bFile []byte
bFile, err = ioutil.ReadFile(c.cs.channel.fileMetaData.Name)
if err != nil {
return
}
os.Stdout.Write(bFile)
os.Remove(c.cs.channel.fileMetaData.Name)
} else {
fmt.Fprintf(os.Stderr, "\nReceived %s written to %s", folderOrFile, c.cs.channel.fileMetaData.Name)
}
}
} else {