Fixed: Fixed an issue where there could be a race condition during app update.

pull/3113/head
kay.one 13 years ago
parent aa42111516
commit 39be4c567d

@ -57,6 +57,12 @@ namespace NzbDrone.Common
return process;
}
public virtual void WaitForExit(Process process)
{
Logger.Trace("Waiting for process {0} to exit.", process.ProcessName);
process.WaitForExit();
}
public virtual void Kill(int processId)
{
if (processId == 0 || !Process.GetProcesses().Any(p => p.Id == processId))

@ -2,6 +2,7 @@
using System;
using System.Diagnostics;
using System.IO;
using FizzWare.NBuilder;
using FluentAssertions;
using Moq;
using NUnit.Framework;

@ -82,12 +82,14 @@ namespace NzbDrone.Core.Jobs
logger.Info("Starting update client");
var startInfo = new ProcessStartInfo
{
FileName = _enviromentProvider.GetUpdateClientExePath(),
Arguments = string.Format("{0} {1}", _enviromentProvider.NzbDroneProcessIdFromEnviroment, _configFileProvider.Guid)
};
FileName = _enviromentProvider.GetUpdateClientExePath(),
Arguments = string.Format("{0} {1}", _enviromentProvider.NzbDroneProcessIdFromEnviroment, _configFileProvider.Guid)
};
_processProvider.Start(startInfo);
var process = _processProvider.Start(startInfo);
notification.CurrentMessage = "Update in progress. NzbDrone will restart shortly.";
_processProvider.WaitForExit(process);
}
}
}
Loading…
Cancel
Save