mirror of
https://github.com/DarthAffe/StableDiffusion.NET.git
synced 2025-12-13 05:48:40 +00:00
27 lines
623 B
C#
27 lines
623 B
C#
using System.Diagnostics;
|
|
|
|
namespace StableDiffusion.NET;
|
|
|
|
internal static class ProcessHelper
|
|
{
|
|
public static string? RunCommand(string command)
|
|
{
|
|
try
|
|
{
|
|
using Process process = new();
|
|
process.StartInfo.UseShellExecute = false;
|
|
process.StartInfo.RedirectStandardOutput = true;
|
|
process.StartInfo.FileName = command;
|
|
process.Start();
|
|
|
|
string output = process.StandardOutput.ReadToEnd();
|
|
process.WaitForExit();
|
|
|
|
return output;
|
|
}
|
|
catch
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
} |