Добавлено ожидание процесса
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using Updater.Core;
|
||||
using System.Diagnostics;
|
||||
using System.Security.Cryptography;
|
||||
using Updater.Core;
|
||||
|
||||
namespace Updater;
|
||||
|
||||
@@ -22,6 +24,22 @@ internal sealed class Program
|
||||
|
||||
Thread.Sleep(options.UpdateDelayMs);
|
||||
|
||||
if (options.WaitProcess != null)
|
||||
try
|
||||
{
|
||||
using (var proc = Process.GetProcessById(options.WaitProcess.Value))
|
||||
{
|
||||
logger.Info($"Waiting for the process to complete {options.WaitProcess}...");
|
||||
proc.WaitForExit(); // блокирует выполнение до завершения процесса
|
||||
logger.Info("Process is completed.");
|
||||
}
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
logger.Info($"Process with PID {options.WaitProcess} not found.");
|
||||
}
|
||||
|
||||
|
||||
var extractor = new ZipExtractor(logger);
|
||||
var installer = new SafeFileInstaller(logger);
|
||||
var procMgr = new ProcessManager(logger);
|
||||
|
||||
Reference in New Issue
Block a user