x
This commit is contained in:
+19
-7
@@ -217,7 +217,8 @@ func AddNodePlugin(path, name string) error {
|
|||||||
f.Suffix = ".js"
|
f.Suffix = ".js"
|
||||||
f.Type = "node"
|
f.Type = "node"
|
||||||
f.Path = path
|
f.Path = path
|
||||||
f.Handle = func(s common.Sender, f func(vm *goja.Runtime)) interface{} {
|
f.Handle = func(s common.Sender, _ func(vm *goja.Runtime)) interface{} {
|
||||||
|
console := &Console{UUID: uuid}
|
||||||
s.SetPluginID(uuid)
|
s.SetPluginID(uuid)
|
||||||
plt := s.GetImType()
|
plt := s.GetImType()
|
||||||
cmd := exec.Command("./node", path)
|
cmd := exec.Command("./node", path)
|
||||||
@@ -261,12 +262,23 @@ func AddNodePlugin(path, name string) error {
|
|||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
scanner := bufio.NewScanner(stderr)
|
scanner := bufio.NewScanner(stderr)
|
||||||
for scanner.Scan() {
|
if f.OnStart {
|
||||||
data := scanner.Text()
|
for scanner.Scan() {
|
||||||
fmt.Println(data)
|
data := scanner.Text()
|
||||||
// if _, err := file.WriteString(data + "\n"); err != nil {
|
// lines = append(lines, data)
|
||||||
// fmt.Printf("写入文件失败:%v\n", err)
|
fmt.Println(data)
|
||||||
// }
|
// if _, err := file.WriteString(data + "\n"); err != nil {
|
||||||
|
// fmt.Printf("写入文件失败:%v\n", err)
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// lines := []string{}
|
||||||
|
for scanner.Scan() {
|
||||||
|
data := scanner.Text()
|
||||||
|
fmt.Println(data)
|
||||||
|
// lines = append(lines, data)
|
||||||
|
}
|
||||||
|
// console.Error(strings.Join(lines, "\n"))
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
processes.Store(cmd, s)
|
processes.Store(cmd, s)
|
||||||
|
|||||||
Reference in New Issue
Block a user