mirror of
https://github.com/MAKS-IT-COM/maksit-certs-ui.git
synced 2025-12-31 12:10:03 +01:00
31 lines
796 B
C#
31 lines
796 B
C#
using System;
|
|
using System.Diagnostics;
|
|
|
|
namespace LetsEncrypt {
|
|
|
|
public interface ITerminalService {
|
|
void Exec(string cmd);
|
|
}
|
|
|
|
public class TerminalService : ITerminalService {
|
|
|
|
public void Exec(string cmd) {
|
|
var escapedArgs = cmd.Replace("\"", "\\\"");
|
|
|
|
var pc = new Process {
|
|
StartInfo = new ProcessStartInfo {
|
|
RedirectStandardOutput = true,
|
|
UseShellExecute = false,
|
|
CreateNoWindow = true,
|
|
WindowStyle = ProcessWindowStyle.Hidden,
|
|
FileName = "/bin/bash",
|
|
Arguments = $"-c \"{escapedArgs}\""
|
|
}
|
|
};
|
|
|
|
pc.Start();
|
|
pc.WaitForExit();
|
|
}
|
|
}
|
|
|
|
} |