Skip to content

Commit 3dd609a

Browse files
committed
Wait indefinite for the setup to complete to minmize the risk for a corrupted database
1 parent 76d9bb7 commit 3dd609a

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

src/ServiceControlInstaller.Engine/Setup/InstanceSetup.cs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,16 @@ static void Run(string installPath, string exeName, string instanceName, bool sk
4646

4747
processStartupInfo.EnvironmentVariables.Add("INSTANCE_NAME", instanceName);
4848

49-
var p = Process.Start(processStartupInfo);
50-
if (p != null)
51-
{
52-
var error = p.StandardError.ReadToEnd();
53-
p.WaitForExit((int)TimeSpan.FromMinutes(1).TotalMilliseconds);
54-
if (!p.HasExited)
55-
{
56-
p.Kill();
57-
throw new TimeoutException($"Timed out waiting for {exeName} to perform setup. This usually indicates a configuration error.");
58-
}
49+
var p = Process.Start(processStartupInfo) ?? throw new Exception($"Attempt to launch {exeName} failed.");
5950

60-
if (p.ExitCode != 0)
61-
{
62-
throw new Exception($"{exeName} threw an error when performing setup. This typically indicates a configuration error. The error output from {exeName} was:\r\n {error}");
63-
}
64-
}
65-
else
51+
var error = p.StandardError.ReadToEnd();
52+
53+
// we will wait "forever" since killing the setup is dangerous and can lead to the database being in an invalid state
54+
p.WaitForExit();
55+
56+
if (p.ExitCode != 0)
6657
{
67-
throw new Exception($"Attempt to launch {exeName} failed.");
58+
throw new Exception($"{exeName} threw an error when performing setup. This typically indicates a configuration error. The error output from {exeName} was:\r\n {error}");
6859
}
6960
}
7061
}

0 commit comments

Comments
 (0)