-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexport.go
60 lines (46 loc) · 1.06 KB
/
export.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package subproc
import (
"fmt"
"github.com/docker/docker/pkg/reexec"
)
var defaultSubProcManager = NewSubProcManager()
func Register(name string, initializer func()) {
reexec.Register(name, func() {
defer func() {
if r := recover(); r != nil {
FailCmd(fmt.Errorf("%s", r))
}
}()
initializer()
})
}
func Init() bool {
return reexec.Init()
}
func Run(cmd string, opts ...CmdOption) error {
return defaultSubProcManager.Run(cmd, opts...)
}
func Kill(opts ...MatchOption) error {
return defaultSubProcManager.Kill(opts...)
}
func Killall() error {
return defaultSubProcManager.Kill(WithMatchAll())
}
func List(opts ...MatchOption) map[string][]SubProc {
return defaultSubProcManager.List(opts...)
}
func ListAll() map[string][]SubProc {
return defaultSubProcManager.List(WithMatchAll())
}
func Restart(opts ...MatchOption) error {
return defaultSubProcManager.Restart(opts...)
}
func RestartAll() error {
return defaultSubProcManager.Restart(WithMatchAll())
}
func Wait() {
defaultSubProcManager.Wait()
}
func Stop() {
defaultSubProcManager.Stop()
}