Skip to content

Commit 94b566d

Browse files
committed
Revert closing of test web server back
We need completely different approach because it doesn't close child process
1 parent 7a9c7a1 commit 94b566d

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

dotnet/test/common/Environment/TestWebServer.cs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,34 @@ public void Start()
150150

151151
public void Stop()
152152
{
153-
webserverProcess.Dispose();
154-
webserverProcess = null;
153+
HttpWebRequest request = WebRequest.Create(EnvironmentManager.Instance.UrlBuilder.LocalWhereIs("quitquitquit")) as HttpWebRequest;
154+
try
155+
{
156+
request.GetResponse();
157+
}
158+
catch (WebException)
159+
{
160+
}
161+
162+
if (webserverProcess != null)
163+
{
164+
try
165+
{
166+
webserverProcess.WaitForExit(10000);
167+
if (!webserverProcess.HasExited)
168+
{
169+
webserverProcess.Kill();
170+
}
171+
}
172+
catch (Exception)
173+
{
174+
}
175+
finally
176+
{
177+
webserverProcess.Dispose();
178+
webserverProcess = null;
179+
}
180+
}
155181
}
156182
}
157183
}

0 commit comments

Comments
 (0)