From 571d6d1f6ce1dc82b2423fac05764b0cbc9f119f Mon Sep 17 00:00:00 2001 From: shaoying Date: Fri, 6 Mar 2020 19:16:11 +0800 Subject: [PATCH] fix ssh.scan repeat --- base/cli/cli.go | 8 +++++++- base/ssh/ssh.go | 5 +---- base/web/web.go | 3 ++- type.go | 3 +-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/base/cli/cli.go b/base/cli/cli.go index c81f3f24..3800c793 100644 --- a/base/cli/cli.go +++ b/base/cli/cli.go @@ -11,6 +11,7 @@ import ( "os/user" "path" "runtime" + "strings" ) var Index = &ice.Context{Name: "cli", Help: "命令模块", @@ -45,7 +46,12 @@ var Index = &ice.Context{Name: "cli", Help: "命令模块", m.Cmd(ice.AAA_ROLE, "root", m.Conf(ice.CLI_RUNTIME, "boot.username")) } if name, e := os.Getwd(); e == nil { - m.Conf(ice.CLI_RUNTIME, "boot.pathname", path.Base(kit.Select(name, os.Getenv("PWD")))) + name = path.Base(kit.Select(name, os.Getenv("PWD"))) + ls := strings.Split(name, "/") + name = ls[len(ls)-1] + ls = strings.Split(name, "\\") + name = ls[len(ls)-1] + m.Conf(ice.CLI_RUNTIME, "boot.pathname", name) } // 启动记录 diff --git a/base/ssh/ssh.go b/base/ssh/ssh.go index 34fe73f6..a621aa2e 100644 --- a/base/ssh/ssh.go +++ b/base/ssh/ssh.go @@ -92,10 +92,7 @@ func (f *Frame) parse(m *ice.Message, line string) *Frame { // 执行命令 msg := m.Spawns(f.target) - if msg.Cmdy(ls[0], ls[1:]); !msg.Hand { - // 系统命令 - msg = msg.Set("result").Cmdy(ice.CLI_SYSTEM, ls) - } + msg.Cmdy(ls[0], ls[1:]) // 转换结果 res := msg.Result() diff --git a/base/web/web.go b/base/web/web.go index 04e758fe..2d2c2c86 100644 --- a/base/web/web.go +++ b/base/web/web.go @@ -415,7 +415,8 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", "timeout.c", "30s", )}, ice.WEB_DREAM: {Name: "dream", Help: "梦想家", Value: kit.Data("path", "usr/local/work", - "cmd", []interface{}{ice.CLI_SYSTEM, "ice.sh", "start", ice.WEB_SPACE, "connect"}, + // "cmd", []interface{}{ice.CLI_SYSTEM, "ice.sh", "start", ice.WEB_SPACE, "connect"}, + "cmd", []interface{}{ice.CLI_SYSTEM, "ice.bin", ice.WEB_SPACE, "connect"}, )}, ice.WEB_FAVOR: {Name: "favor", Help: "收藏夹", Value: kit.Data(kit.MDB_SHORT, kit.MDB_NAME)}, diff --git a/type.go b/type.go index f30e3cfb..3adc0bc4 100644 --- a/type.go +++ b/type.go @@ -1458,8 +1458,7 @@ func (m *Message) Cmd(arg ...interface{}) *Message { }) if m.Warn(m.Hand == false, "not found %v", list) { - m.Cmdy(CLI_SYSTEM, list) - m.Hand = true + return m.Set(MSG_RESULT).Cmd(CLI_SYSTEM, list) } return m }