diff --git a/Setup/Git.cs b/Setup/Git.cs index 217c965b6..d6e6a9830 100644 --- a/Setup/Git.cs +++ b/Setup/Git.cs @@ -4,16 +4,16 @@ public static class Git { public static void Add(string path) { - $"git add \"{path}\" -f".RunWithBash(); + $"git add \"{path}\" -f".RunWithPowerShell(); } public static void Commit(string message) { - $"git commit -m \"{message}\"".RunWithBash(); + $"git commit -m \"{message}\"".RunWithPowerShell(); } public static void Push() { - "git push".RunWithBash(); + "git push".RunWithPowerShell(); } } \ No newline at end of file diff --git a/Setup/Release.cs b/Setup/Release.cs index 848a0e68d..9de0b6913 100644 --- a/Setup/Release.cs +++ b/Setup/Release.cs @@ -1,5 +1,3 @@ -using System; - namespace Setup; public class Release @@ -24,8 +22,6 @@ public void Run() package.Save(); Git.Add(package.Path); - - Console.WriteLine(package.Path); } Git.Commit($"Release {_version}"); diff --git a/Setup/Setup.csproj b/Setup/Setup.csproj index b35ce995f..b3fdb30b0 100644 --- a/Setup/Setup.csproj +++ b/Setup/Setup.csproj @@ -7,6 +7,7 @@ + diff --git a/Setup/Utils.cs b/Setup/Utils.cs index 29dcb675b..5e349f2b1 100644 --- a/Setup/Utils.cs +++ b/Setup/Utils.cs @@ -1,35 +1,17 @@ using System; +using System.Collections.ObjectModel; using System.Diagnostics; +using System.Management.Automation; namespace Setup; public static class Utils { - public static void RunWithBash( this string cmd ) + public static void RunWithPowerShell(this string command) { - cmd = cmd.Replace( "\"", "\\\"" ); - - Process process = new Process() - { - StartInfo = new ProcessStartInfo - { - FileName = "/bin/bash", - Arguments = $"-c \"{cmd}\"", - RedirectStandardOutput = true, - UseShellExecute = false, - CreateNoWindow = true, - } - }; - - process.Start(); - - string result = process.StandardOutput.ReadToEnd(); - - process.WaitForExit(); - - foreach (string line in result.Split('\n')) + using (PowerShell powershell = PowerShell.Create()) { - Console.WriteLine(line); + var output = powershell.AddScript(@command).Invoke(); } } } \ No newline at end of file