MCPcopy Index your code
hub / github.com/getlantern/sysproxy / waitAndCleanup

Function waitAndCleanup

sysproxy.go:101–125  ·  view source on GitHub ↗
(host string, port string)

Source from the content-addressed store, hash-verified

99}
100
101func waitAndCleanup(host string, port string) (func() error, error) {
102 cmd := be.Command("wait-and-cleanup", host, port)
103 stdin, err := cmd.StdinPipe()
104 if err != nil {
105 return nil, err
106 }
107 // Set up the command to run as a detached process
108 detach(cmd)
109 resultCh := make(chan *resultType)
110 go func() {
111 out, err := cmd.CombinedOutput()
112 resultCh <- &resultType{
113 out: out,
114 err: err,
115 }
116 }()
117 return func() error {
118 stdin.Close()
119 result := <-resultCh
120 if result.err != nil {
121 return fmt.Errorf("unable to finish %v: %s\n%s", cmd.Path, result.err, string(result.out))
122 }
123 return verify("")
124 }, nil
125}
126
127func run(cmd *exec.Cmd) error {
128 out, err := cmd.CombinedOutput()

Callers 1

OnFunction · 0.85

Calls 2

verifyFunction · 0.85
detachFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…