-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.go
35 lines (29 loc) · 773 Bytes
/
run.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
34
35
package main
import (
"os"
"strings"
"github.com/scaat/kangaroo/container"
"github.com/sirupsen/logrus"
)
func Run(tty bool, comArray []string) {
parent, writePipe := container.NewParentProcess(tty)
if parent == nil {
logrus.Errorf("New parent process error")
return
}
if err := parent.Start(); err != nil {
logrus.Error(err)
}
// cgroupManager := cgroups.NewCgroupManager("kangaroo-cgroup")
// defer cgroupManager.Destroy()
// cgroupManager.Set(res)
// cgroupManager.Apply(parent.Process.Pid)
sendInitCommand(comArray, writePipe)
parent.Wait()
}
func sendInitCommand(comArray []string, writePipe *os.File) {
command := strings.Join(comArray, " ")
logrus.Infof("command all is %s", command)
writePipe.WriteString(command)
writePipe.Close()
}