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

Method Close

aetest/instance_vm.go:77–112  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

75
76// Close kills the child api_server.py process, releasing its resources.
77func (i *instance) Close() (err error) {
78 child := i.child
79 if child == nil {
80 return nil
81 }
82 defer func() {
83 i.child = nil
84 err1 := os.RemoveAll(i.appDir)
85 if err == nil {
86 err = err1
87 }
88 }()
89
90 if p := child.Process; p != nil {
91 errc := make(chan error, 1)
92 go func() {
93 errc <- child.Wait()
94 }()
95
96 // Call the quit handler on the admin server.
97 res, err := http.Get(i.adminURL + "/quit")
98 if err != nil {
99 p.Kill()
100 return fmt.Errorf("unable to call /quit handler: %v", err)
101 }
102 res.Body.Close()
103 select {
104 case <-time.After(15 * time.Second):
105 p.Kill()
106 return errors.New("timeout killing child process")
107 case err = <-errc:
108 // Do nothing.
109 }
110 }
111 return
112}
113
114func fileExists(path string) bool {
115 _, 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