25 lines
No EOL
610 B
C#
25 lines
No EOL
610 B
C#
using System.Diagnostics;
|
|
|
|
namespace Api;
|
|
|
|
public static class Ebasher
|
|
{
|
|
public static string Bash(this string cmd)
|
|
{
|
|
cmd = cmd.Replace("\"", "\\\"");
|
|
var proc = new Process
|
|
{
|
|
StartInfo = new ProcessStartInfo
|
|
{
|
|
FileName = "bin/bash",
|
|
Arguments = $"-c \"{cmd}\"",
|
|
UseShellExecute = false,
|
|
RedirectStandardOutput = true,
|
|
CreateNoWindow = true
|
|
}
|
|
};
|
|
proc.Start();
|
|
proc.WaitForExit();
|
|
return proc.StandardOutput.ReadToEnd();
|
|
}
|
|
} |