wabbajack/Wabbajack.Common/Extensions/ProcessExt.cs
2019-12-22 01:58:10 -06:00

23 lines
690 B
C#

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Wabbajack.Common
{
public static class ProcessExt
{
public static void WaitForExitAndWarn(this Process process, TimeSpan warningTimeout, string processTitle)
{
if (!process.WaitForExit((int)warningTimeout.TotalMilliseconds))
{
Utils.Status($"{processTitle} - Taking a long time to exit.", alsoLog: true);
process.WaitForExit();
Utils.Status($"{processTitle} - Exited after a long period.", alsoLog: true);
}
}
}
}