Skip to content

Commit

Permalink
Revert closing of test web server back
Browse files Browse the repository at this point in the history
We need completely different approach because it doesn't close child process
  • Loading branch information
nvborisenko committed Dec 1, 2023
1 parent 7a9c7a1 commit 94b566d
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions dotnet/test/common/Environment/TestWebServer.cs
Expand Up @@ -150,8 +150,34 @@ public void Start()

public void Stop()
{
webserverProcess.Dispose();
webserverProcess = null;
HttpWebRequest request = WebRequest.Create(EnvironmentManager.Instance.UrlBuilder.LocalWhereIs("quitquitquit")) as HttpWebRequest;
try
{
request.GetResponse();
}
catch (WebException)
{
}

if (webserverProcess != null)
{
try
{
webserverProcess.WaitForExit(10000);
if (!webserverProcess.HasExited)
{
webserverProcess.Kill();
}
}
catch (Exception)
{
}
finally
{
webserverProcess.Dispose();
webserverProcess = null;
}
}
}
}
}

0 comments on commit 94b566d

Please sign in to comment.