mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Make HasExitedSafe() private
This commit is contained in:
parent
48bbcbb426
commit
1c13be085f
@ -10,28 +10,6 @@ namespace MediaBrowser.Common.Extensions
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class ProcessExtensions
|
public static class ProcessExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Gets a value indicating whether the associated process has been terminated using
|
|
||||||
/// <see cref="Process.HasExited"/>. This is safe to call even if there is no operating system process
|
|
||||||
/// associated with the <see cref="Process"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="process">The process to check the exit status for.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// True if the operating system process referenced by the <see cref="Process"/> component has
|
|
||||||
/// terminated, or if there is no associated operating system process; otherwise, false.
|
|
||||||
/// </returns>
|
|
||||||
public static bool HasExitedSafe(this Process process)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return process.HasExited;
|
|
||||||
}
|
|
||||||
catch (InvalidOperationException)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Asynchronously wait for the process to exit.
|
/// Asynchronously wait for the process to exit.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -75,5 +53,27 @@ namespace MediaBrowser.Common.Extensions
|
|||||||
return await tcs.Task.ConfigureAwait(false);
|
return await tcs.Task.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether the associated process has been terminated using
|
||||||
|
/// <see cref="Process.HasExited"/>. This is safe to call even if there is no operating system process
|
||||||
|
/// associated with the <see cref="Process"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="process">The process to check the exit status for.</param>
|
||||||
|
/// <returns>
|
||||||
|
/// True if the operating system process referenced by the <see cref="Process"/> component has
|
||||||
|
/// terminated, or if there is no associated operating system process; otherwise, false.
|
||||||
|
/// </returns>
|
||||||
|
private static bool HasExitedSafe(this Process process)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return process.HasExited;
|
||||||
|
}
|
||||||
|
catch (InvalidOperationException)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user