MCPcopy Create free account
hub / github.com/golang/appengine / Close

Method Close

v2/aetest/instance.go:127–162  ·  view source on GitHub ↗

Close kills the child api_server.py process, releasing its resources.

()

Source from the content-addressed store, hash-verified

125
126// Close kills the child api_server.py process, releasing its resources.
127func (i *instance) Close() (err error) {
128 child := i.child
129 if child == nil {
130 return nil
131 }
132 defer func() {
133 i.child = nil
134 err1 := os.RemoveAll(i.appDir)
135 if err == nil {
136 err = err1
137 }
138 }()
139
140 if p := child.Process; p != nil {
141 errc := make(chan error, 1)
142 go func() {
143 errc <- child.Wait()
144 }()
145
146 // Call the quit handler on the admin server.
147 res, err := http.Get(i.adminURL + "/quit")
148 if err != nil {
149 p.Kill()
150 return fmt.Errorf("unable to call /quit handler: %v", err)
151 }
152 res.Body.Close()
153 select {
154 case <-time.After(15 * time.Second):
155 p.Kill()
156 return errors.New("timeout killing child process")
157 case err = <-errc:
158 // Do nothing.
159 }
160 }
161 return
162}
163
164func fileExists(path string) bool {
165 _, err := os.Stat(path)

Callers 3

TestBasicAPICallsFunction · 0.45
TestUsersFunction · 0.45
NewContextFunction · 0.45

Calls 1

GetMethod · 0.45

Tested by 2

TestBasicAPICallsFunction · 0.36
TestUsersFunction · 0.36