mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-25 12:49:26 +01:00
(Hopefully) avoid exception when checking if proc has exited (to avoid debugging clutter)
This commit is contained in:
@@ -333,5 +333,19 @@ namespace Flowframes.Os
|
||||
|
||||
return string.Join(";", newPaths.Select(x => x.Replace("\\", "/"))) + ";";
|
||||
}
|
||||
|
||||
public static bool IsStillRunning(Func<Process> proc) // For .NET Core migration: Func<Process?> (nullable)
|
||||
{
|
||||
var p = proc(); // Snapshot of the process to avoid race condition
|
||||
|
||||
try
|
||||
{
|
||||
return p is null || !p.HasExited;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -182,7 +182,7 @@ namespace Flowframes
|
||||
|
||||
// Logger.Log($"Disk space check for '{drivePath}/': {spaceGb} GB free, next check in {nextWaitTimeMs / 1024} sec", true);
|
||||
|
||||
if (!Interpolate.canceled && (AiProcess.lastAiProcess != null && !AiProcess.lastAiProcess.HasExited) && lowDiskSpace)
|
||||
if (!Interpolate.canceled && OsUtils.IsStillRunning(() => AiProcess.lastAiProcess) && lowDiskSpace)
|
||||
{
|
||||
if (tooLowDiskSpace)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user