Skip to content

Commit

Permalink
Merge pull request #51 from browserstack/alpine-fix
Browse files Browse the repository at this point in the history
fix: runShellCommand
  • Loading branch information
kamal-kaur04 authored Jan 6, 2025
2 parents 5bfd594 + 06e496a commit 0d13cfa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion BrowserStackLocal/BrowserStackLocal/BrowserStackTunnel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static bool IsAlpine()
{
try
{
string[] output = Util.RunShellCommand("grep -w 'NAME' /etc/os-release");
string[] output = Util.RunShellCommand("grep", "-w \'NAME\' /etc/os-release");
return output[0]?.ToLower()?.Contains("alpine") ?? false;
}
catch (System.Exception ex)
Expand Down
8 changes: 5 additions & 3 deletions BrowserStackLocal/BrowserStackLocal/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ namespace BrowserStack
public class Util {

// Only Unix Support
public static string[] RunShellCommand(string command)
public static string[] RunShellCommand(string command, string args = "")
{
ProcessStartInfo psi = new ProcessStartInfo("bash", $"-c \"{command}\"") {
ProcessStartInfo psi = new ProcessStartInfo {
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
CreateNoWindow = true
CreateNoWindow = true,
FileName = command,
Arguments = args
};

Process process = new Process { StartInfo = psi };
Expand Down

0 comments on commit 0d13cfa

Please sign in to comment.