From 05c4c401e6391cdb12f9dfde6771dff481998bb3 Mon Sep 17 00:00:00 2001 From: harveyshao Date: Wed, 13 Jul 2022 08:20:07 +0800 Subject: [PATCH] opt vimer.js --- base/cli/runtime.go | 10 +++++++++- base/cli/system.go | 4 +++- core/code/go.go | 4 ++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/base/cli/runtime.go b/base/cli/runtime.go index 2289ecfc..49226f83 100644 --- a/base/cli/runtime.go +++ b/base/cli/runtime.go @@ -45,7 +45,15 @@ func _runtime_init(m *ice.Message) { // 启动次数 boot m.Conf(RUNTIME, kit.Keys(BOOT, mdb.COUNT), kit.Int(m.Conf(RUNTIME, kit.Keys(BOOT, mdb.COUNT)))+1) - m.Conf(RUNTIME, kit.Keys(BOOT, ice.BIN), _system_find(m, os.Args[0])) + bin := _system_find(m, os.Args[0]) + m.Conf(RUNTIME, kit.Keys(BOOT, ice.BIN), bin) + if s, e := os.Stat(bin); e == nil { + m.Conf(RUNTIME, kit.Keys(BOOT, "size"), kit.FmtSize(s.Size())) + if f, e := os.Open(bin); e == nil { + defer f.Close() + m.Conf(RUNTIME, kit.Keys(BOOT, "hash"), kit.Hashs(f)) + } + } // 环境变量 conf for _, k := range []string{CTX_SHY, CTX_DEV, CTX_OPS, CTX_ARG, CTX_PID, CTX_USER, CTX_SHARE, CTX_RIVER, CTX_DAEMON} { diff --git a/base/cli/system.go b/base/cli/system.go index 2fd0a26b..8ab4d521 100644 --- a/base/cli/system.go +++ b/base/cli/system.go @@ -113,7 +113,9 @@ func _system_exec(m *ice.Message, cmd *exec.Cmd) { defer func() { m.Push(CMD_OUT, out.String()) m.Push(CMD_ERR, err.String()) - m.Echo(strings.TrimSpace(kit.Select(out.String(), err.String()))) + if m.Echo(strings.TrimSpace(kit.Select(out.String(), err.String()))); IsSuccess(m) { + m.SetAppend() + } }() cmd.Stdout, cmd.Stderr = out, err } diff --git a/core/code/go.go b/core/code/go.go index 09ff1360..b4e26740 100644 --- a/core/code/go.go +++ b/core/code/go.go @@ -82,6 +82,10 @@ func _go_doc(m *ice.Message, mod string, pkg string) *ice.Message { } func _go_exec(m *ice.Message, arg ...string) { + if m.Option("some") == "run" { + m.Cmdy(cli.SYSTEM, "./bin/ice.bin", ice.GetFileCmd(path.Join(arg[2], arg[1]))) + return + } if m.Option(mdb.TEXT) == "" { if m.Option(nfs.LINE) == "1" { m.Push(mdb.NAME, "package")