1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00
This commit is contained in:
shaoying 2021-05-30 00:33:14 +08:00
parent 26f93d5aca
commit 83e6775ad4
4 changed files with 22 additions and 7 deletions

View File

@ -27,6 +27,7 @@ func _system_show(m *ice.Message, cmd *exec.Cmd) {
if e := cmd.Run(); e != nil {
m.Warn(e != nil, ErrRun, strings.Join(cmd.Args, " "), "\n", e.Error())
m.Push(CMD_ERR, e.Error())
} else {
m.Cost("args", cmd.Args, "code", cmd.ProcessState.ExitCode())
}
@ -44,6 +45,7 @@ func _system_show(m *ice.Message, cmd *exec.Cmd) {
if e := cmd.Run(); e != nil {
m.Warn(e != nil, ErrRun, strings.Join(cmd.Args, " "), "\n", kit.Select(e.Error(), err.String()))
fmt.Fprintf(err, e.Error())
} else {
m.Cost("args", cmd.Args, "code", cmd.ProcessState.ExitCode(), "err", err.Len(), "out", out.Len())
}

View File

@ -17,8 +17,11 @@ const ( // REPOS
CONTEXTS = "contexts"
INTSHELL = "intshell"
PUBLISH = "publish"
REQUIRE = "require"
PUBLISH = "publish"
SUCCESS = "success"
FAILURE = "failure"
)
const ( // DIR
USR_VOLCANOS = "usr/volcanos"

View File

@ -70,26 +70,32 @@ func init() {
// 推流
web.PushStream(m)
defer func() { m.Toast("success", "build") }()
defer func() { m.ProcessHold() }()
// 配置
switch cb := m.Optionv(PREPARE).(type) {
case func(string):
cb(p)
default:
if m.Cmd(cli.SYSTEM, "./configure", "--prefix="+pp, arg[1:]).Append(cli.CMD_CODE) != "0" {
if msg := m.Cmd(cli.SYSTEM, "./configure", "--prefix="+pp, arg[1:]); msg.Append(cli.CMD_CODE) != "0" {
m.Echo(msg.Append(cli.CMD_ERR))
return
}
}
// 编译
if m.Cmd(cli.SYSTEM, "make", "-j8").Append(cli.CMD_CODE) != "0" {
if msg := m.Cmd(cli.SYSTEM, "make", "-j8"); msg.Append(cli.CMD_CODE) != "0" {
m.Echo(msg.Append(cli.CMD_ERR))
return
}
// 安装
m.Cmd(cli.SYSTEM, "make", "PREFIX="+pp, "install")
if msg := m.Cmd(cli.SYSTEM, "make", "PREFIX="+pp, "install"); msg.Append(cli.CMD_CODE) != "0" {
m.Echo(msg.Append(cli.CMD_ERR))
return
}
m.Toast(ice.SUCCESS, gdb.BUILD)
m.ProcessHold()
}},
gdb.SPAWN: {Name: "spawn link", Help: "新建", Hand: func(m *ice.Message, arg ...string) {
port := m.Cmdx(tcp.PORT, aaa.RIGHT)

View File

@ -266,6 +266,10 @@ type Sort struct {
}
func (m *Message) Toast(content string, arg ...interface{}) {
if m.Option(MSG_USERPOD) == "" {
return
}
if len(arg) > 1 {
switch val := arg[1].(type) {
case string:
@ -274,7 +278,7 @@ func (m *Message) Toast(content string, arg ...interface{}) {
}
}
}
m.Cmd("web.space", m.Option("_daemon"), "toast", "", content, arg)
m.Cmd("web.space", m.Option(MSG_DAEMON), "toast", "", content, arg)
}
func (m *Message) GoToast(title string, cb func(toast func(string, int, int))) {
m.Go(func() {