Commit 15dc75cd authored by Eric's avatar Eric Committed by Eric_Lee

fix close bugs

parent 4d94f931
...@@ -56,9 +56,9 @@ func (c *Client) Pty() ssh.Pty { ...@@ -56,9 +56,9 @@ func (c *Client) Pty() ssh.Pty {
} }
func (c *Client) Close() (err error) { func (c *Client) Close() (err error) {
//if c.Closed { if c.Closed {
// return return
//} }
c.Closed = true c.Closed = true
return c.UserWrite.Close() return c.UserWrite.Close()
} }
...@@ -34,7 +34,6 @@ func newParser() *Parser { ...@@ -34,7 +34,6 @@ func newParser() *Parser {
// Parse 解析用户输入输出, 拦截过滤用户输入输出 // Parse 解析用户输入输出, 拦截过滤用户输入输出
type Parser struct { type Parser struct {
inputBuf *bytes.Buffer
cmdBuf *bytes.Buffer cmdBuf *bytes.Buffer
outputBuf *bytes.Buffer outputBuf *bytes.Buffer
...@@ -62,7 +61,6 @@ type Parser struct { ...@@ -62,7 +61,6 @@ type Parser struct {
} }
func (p *Parser) initial() { func (p *Parser) initial() {
p.inputBuf = new(bytes.Buffer)
p.cmdBuf = new(bytes.Buffer) p.cmdBuf = new(bytes.Buffer)
p.outputBuf = new(bytes.Buffer) p.outputBuf = new(bytes.Buffer)
...@@ -142,7 +140,7 @@ func (p *Parser) parseCmdInput() { ...@@ -142,7 +140,7 @@ func (p *Parser) parseCmdInput() {
data := p.cmdBuf.Bytes() data := p.cmdBuf.Bytes()
p.command = p.cmdInputParser.Parse(data) p.command = p.cmdInputParser.Parse(data)
p.cmdBuf.Reset() p.cmdBuf.Reset()
p.inputBuf.Reset() //p.inputBuf.Reset()
} }
// parseCmdOutput 解析命令输出 // parseCmdOutput 解析命令输出
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment