Fix flaky TestVMessDynamicPort (#723)

This commit is contained in:
yuhan6665 2021-09-23 23:59:00 -04:00 committed by GitHub
parent a149c78a4c
commit 9f9059c7b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 111 additions and 51 deletions

View file

@ -143,6 +143,23 @@ func CloseAllServers(servers []*exec.Cmd) {
})
}
func CloseServer(server *exec.Cmd) {
log.Record(&log.GeneralMessage{
Severity: log.Severity_Info,
Content: "Closing server.",
})
if runtime.GOOS == "windows" {
server.Process.Kill()
} else {
server.Process.Signal(syscall.SIGTERM)
}
server.Process.Wait()
log.Record(&log.GeneralMessage{
Severity: log.Severity_Info,
Content: "Server closed.",
})
}
func withDefaultApps(config *core.Config) *core.Config {
config.App = append(config.App, serial.ToTypedMessage(&dispatcher.Config{}))
config.App = append(config.App, serial.ToTypedMessage(&proxyman.InboundConfig{}))