diff --git a/conf.go b/conf.go index 97f4a470..dffd0869 100644 --- a/conf.go +++ b/conf.go @@ -210,6 +210,7 @@ const ( // PROCESS ) const ( // Err ErrWarn = "warn: " + ErrPanic = "panic: " ErrExists = "exists: " ErrExpire = "expire: " ErrTimeout = "timeout: " diff --git a/exec.go b/exec.go index 173d87e3..d0538581 100644 --- a/exec.go +++ b/exec.go @@ -40,13 +40,15 @@ func (m *Message) Assert(expr interface{}) bool { case nil: return true case error: - panic(expr) case bool: if expr == true { return true } + default: + expr = errors.New(kit.Format("error: %v", expr)) } - panic(errors.New(kit.Format("error: %v", expr))) + m.Result(ErrPanic, expr) + panic(expr) } func (m *Message) Sleep(d string) *Message { m.Debug("sleep %s %s", d, kit.FileLine(2, 3)) diff --git a/init.go b/init.go index 0691d726..80901d3a 100644 --- a/init.go +++ b/init.go @@ -108,7 +108,6 @@ func Run(arg ...string) string { Index.root, Pulse.root = Index, Pulse Pulse.Option(CACHE_LIMIT, "10") - log.LogDisable = false switch Index.Merge(Index).Begin(Pulse.Spawn(), arg...); kit.Select("", arg, 0) { case "serve", "space": if log.LogDisable = false; Index.Start(Pulse, arg...) { diff --git a/misc/ssh/connect.go b/misc/ssh/connect.go index fc5a1e53..3ceeae2f 100644 --- a/misc/ssh/connect.go +++ b/misc/ssh/connect.go @@ -170,7 +170,7 @@ func init() { CONNECT: {Name: "connect hash auto dial prunes", Help: "连接", Action: map[string]*ice.Action{ tcp.OPEN: {Name: "open authfile username=shy password verfiy host=shylinux.com port=22 private=.ssh/id_rsa", Help: "终端", Hand: func(m *ice.Message, arg ...string) { _ssh_open(m.OptionLoad(m.Option("authfile")), arg...) - m.Echo("exit %v:%v\n", m.Option(tcp.HOST), m.Option(tcp.PORT)) + m.Echo("exit %v@%v:%v\n", m.Option(aaa.USERNAME), m.Option(tcp.HOST), m.Option(tcp.PORT)) }}, tcp.DIAL: {Name: "dial username=shy host=shylinux.com port=22 private=.ssh/id_rsa", Help: "添加", Hand: func(m *ice.Message, arg ...string) { m.Go(func() { diff --git a/option.go b/option.go index 41106b0f..9e0e33aa 100644 --- a/option.go +++ b/option.go @@ -34,9 +34,11 @@ func (m *Message) OptionLoad(file string) *Message { defer f.Close() var data interface{} - json.NewDecoder(f).Decode(&data) + m.Assert(json.NewDecoder(f).Decode(&data)) - kit.Fetch(data, func(key string, value interface{}) { m.Option(key, kit.Simple(value)) }) + kit.Fetch(data, func(key string, value interface{}) { + m.Option(key, kit.Simple(value)) + }) } return m }