All checks were successful
ci/woodpecker/push/push_to_repo Pipeline was successful
35 lines
931 B
C#
35 lines
931 B
C#
using System.Diagnostics;
|
|
|
|
namespace DeploymentAgent.Shell;
|
|
|
|
public class ShellRunner : IShellRunner
|
|
{
|
|
public (int ExitCode, string StdOut, string StdErr) RunScript(string script)
|
|
{
|
|
var psi = new ProcessStartInfo
|
|
{
|
|
FileName = "/bin/sh",
|
|
Arguments = "-s",
|
|
RedirectStandardInput = true,
|
|
RedirectStandardOutput = true,
|
|
RedirectStandardError = true,
|
|
UseShellExecute = false,
|
|
CreateNoWindow = true
|
|
};
|
|
|
|
using var process = new Process();
|
|
process.StartInfo = psi;
|
|
|
|
process.Start();
|
|
|
|
process.StandardInput.WriteLine(script);
|
|
process.StandardInput.Close();
|
|
|
|
var output = process.StandardOutput.ReadToEnd();
|
|
var error = process.StandardError.ReadToEnd();
|
|
|
|
process.WaitForExit();
|
|
|
|
return (process.ExitCode, output, error);
|
|
}
|
|
} |