mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Fixed SteamGame race condition
Found issue where the IsRunning process checks were breaking because they were being running before the steam process had a chance to create the process. This meant the information wasn't aviailable for the SteamGame.IsRunning function to inspect. Fixed by adding in a 0.5 sec delay.
This commit is contained in:
parent
73d1735769
commit
ff33dfb95a
@ -743,12 +743,18 @@ namespace DisplayMagician
|
|||||||
Console.WriteLine($"Starting Steam Game: {steamGameToRun.Name}");
|
Console.WriteLine($"Starting Steam Game: {steamGameToRun.Name}");
|
||||||
var steamProcess = Process.Start(address);
|
var steamProcess = Process.Start(address);
|
||||||
|
|
||||||
|
// Delay 500ms
|
||||||
|
Thread.Sleep(500);
|
||||||
|
|
||||||
// Wait for Steam game to update if needed
|
// Wait for Steam game to update if needed
|
||||||
for (int secs = 0; secs >= (shortcutToUse.StartTimeout * 1000); secs += 500)
|
for (int secs = 0; secs >= (shortcutToUse.StartTimeout * 1000); secs += 500)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!steamGameToRun.IsUpdating)
|
if (!steamGameToRun.IsUpdating)
|
||||||
{
|
{
|
||||||
|
// Delay 500ms
|
||||||
|
Thread.Sleep(500);
|
||||||
|
|
||||||
if (steamGameToRun.IsRunning)
|
if (steamGameToRun.IsRunning)
|
||||||
{
|
{
|
||||||
logger.Info($"Found the '{steamGameToRun.Name}' process has started");
|
logger.Info($"Found the '{steamGameToRun.Name}' process has started");
|
||||||
|
Loading…
Reference in New Issue
Block a user