Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(playwrighttesting): use bash for linux and osx git commands #47181

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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