This commit is contained in:
1-6
2023-07-28 12:12:32 +08:00
parent a1de3097c8
commit ee0ceededf
6 changed files with 40 additions and 5 deletions
+2 -1
View File
@@ -24,7 +24,7 @@ type Language struct {
}
var plugin_dir = utils.ExecPath + "/plugins"
var release = "20230727"
var release = "20230728"
var languages = []Language{
{
@@ -46,6 +46,7 @@ var languages = []Language{
Version: release,
Os: "windows",
Arch: "amd64",
Links: []string{"https://gitee.com/sillybot/binary/releases/download/" + release + "/node_windows_amd64.zip"},
},
}
+4 -1
View File
@@ -234,6 +234,7 @@ func AddNodePlugin(path, name string) error {
if err != nil {
return err
}
defer file.Close()
data, err := ioutil.ReadAll(file)
if err != nil {
return err
@@ -336,7 +337,9 @@ func AddNodePlugin(path, name string) error {
defer func() {
recover()
}()
p.Process.Kill()
if p.Process.Kill() == nil {
processes.Delete(key)
}
}()
}
return true
+17
View File
@@ -6,6 +6,7 @@ import (
"io"
"net/http"
"os"
"os/exec"
"path/filepath"
"reflect"
"regexp"
@@ -179,6 +180,22 @@ func initPlugins() {
go f.Reload()
} else if new == "" {
ss := strings.Split(filename, "/")
processes.Range(func(key, value any) bool { //先停止脚本,避免windows锁定文件
p := key.(*exec.Cmd)
s := value.(common.Sender)
if s.GetPluginID() == f.UUID {
console.Log("已终止 % s", f.Title)
func() {
defer func() {
recover()
}()
if p.Process.Kill() == nil {
processes.Delete(key)
}
}()
}
return true
})
os.RemoveAll(filepath.Dir(filename))
// fmt.Println(strings.Join(ss, " "))
if len(ss) > 2 {