Skip to content

Commit

Permalink
fix(playwrighttesting): use bash for linux and osx git commands (#47181)
Browse files Browse the repository at this point in the history
Co-authored-by: Siddharth Singha Roy <[email protected]>
  • Loading branch information
Sid200026 and Siddharth Singha Roy authored Nov 15, 2024
1 parent 5bc6faf commit 7670deb
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Threading.Tasks;
using Azure.Core.Pipeline;
Expand Down Expand Up @@ -80,7 +81,18 @@ internal static string GetRunName(CIInfo ciInfo)

internal static async Task<string> RunCommandAsync(string command, bool async = false)
{
var processInfo = new ProcessStartInfo("cmd", $"/c {command}")
string shell, shellArgs;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
shell = "/bin/bash";
shellArgs = $"-c \"{command}\"";
}
else
{
shell = "cmd";
shellArgs = $"/c {command}";
}
var processInfo = new ProcessStartInfo(shell, shellArgs)
{
RedirectStandardOutput = true,
UseShellExecute = false,
Expand Down

0 comments on commit 7670deb

Please sign in to comment.