@joebigelow / wix / commits / 5eabd27e

Fix timeout

Increase WixNative*.exe timeout to 10 minutes and properly handle when there's a timeout.

Bob Arnson committed May 7, 2020 at 21:34 UTC 5eabd27e1af2827228b1ed925664bc15d9035484
1 file changed +10 -5
src/WixToolset.Core.Native/WixNativeExe.cs
+10 -5
@@ -11,7 +11,7 @@ namespace WixToolset.Core.Native
11
12 internal class WixNativeExe
13 {
14 - private const int FiveMinutesInMilliseconds = 300000;
14 + private const int TenMinutesInMilliseconds = 600000;
15 private static string PathToWixNativeExe;
16
17 private readonly string commandLine;
@@ -63,17 +63,22 @@ namespace WixToolset.Core.Native
63 process.StandardInput.WriteLine();
64 }
65
66 - if (process.WaitForExit(FiveMinutesInMilliseconds))
66 + if (process.WaitForExit(TenMinutesInMilliseconds))
67 {
68 // If the process successfully exits documentation says we need to wait again
69 // without a timeout to ensure that all of the redirected output is captured.
70 //
71 process.WaitForExit();
72 - }
72
74 - if (process.ExitCode != 0)
73 + if (process.ExitCode != 0)
74 + {
75 + throw new Win32Exception(process.ExitCode);
76 + }
77 + }
78 + else
79 {
76 - throw new Win32Exception(process.ExitCode);
80 + process.Kill();
81 + throw new Win32Exception(1460/*ERROR_TIMEOUT*/);
82 }
83 }
84