forked from YaoApp/yao
-
Notifications
You must be signed in to change notification settings - Fork 0
/
process.go
33 lines (27 loc) · 804 Bytes
/
process.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package system
// func init() {
// // gou.RegisterProcessHandler("yao.system.Exec", processExec)
// }
// // processExec execute the system command
// func processExec(process *gou.Process) interface{} {
// process.ValidateArgNums(1)
// cmd := process.ArgsString(0)
// _, err := exec.LookPath(cmd)
// if err != nil {
// exception.New("command %s not found: %s", 400, cmd, err.Error()).Throw()
// return nil
// }
// args := []string{}
// for i, arg := range process.Args {
// if i == 0 {
// continue
// }
// args = append(args, fmt.Sprintf("%v", arg))
// }
// res, err := exec.Command(cmd, args...).Output()
// if err != nil {
// exception.New("command %s error: %s", 500, cmd, err.Error()).Throw()
// return nil
// }
// return strings.TrimRight(string(res), "\n")
// }