From 1611b2fbcd0af0f05d01d69ed28d734fcf969ab5 Mon Sep 17 00:00:00 2001 From: shaoying Date: Fri, 5 Jan 2018 00:24:14 +0800 Subject: [PATCH] =?UTF-8?q?vps=20add=20read=20log=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E6=96=87=E4=BB=B6=E6=97=B6=E7=9A=84=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/context/nfs/nfs.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/context/nfs/nfs.go b/src/context/nfs/nfs.go index 6725d4f3..083a7173 100644 --- a/src/context/nfs/nfs.go +++ b/src/context/nfs/nfs.go @@ -127,16 +127,17 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心", } defer f.Close() + m.Meta = nil size := 1024 if len(arg) > 1 { if s, e := strconv.Atoi(arg[1]); e == nil { size = s } } - buf := make([]byte, size) - f.Read(buf) - m.Echo(string(buf)) + l, e := f.Read(buf) + m.Echo(string(buf[:l])) + m.Log("info", nil, "read %d", l) }}, "save": &ctx.Command{Name: "save file string...", Help: "写入文件, string: 写入内容, pos: 写入位置", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) { f, e := os.Create(arg[0])