From b046baa30692ed79df535d1781546032719dd22b Mon Sep 17 00:00:00 2001 From: Kamalpreet Kaur Date: Fri, 3 Jan 2025 16:12:24 +0530 Subject: [PATCH 1/3] fix: runShellCommand --- BrowserStackLocal/BrowserStackLocal/Util.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/BrowserStackLocal/BrowserStackLocal/Util.cs b/BrowserStackLocal/BrowserStackLocal/Util.cs index f3d5a1e..235d8ea 100644 --- a/BrowserStackLocal/BrowserStackLocal/Util.cs +++ b/BrowserStackLocal/BrowserStackLocal/Util.cs @@ -8,11 +8,12 @@ public class Util { // Only Unix Support public static string[] RunShellCommand(string command) { - ProcessStartInfo psi = new ProcessStartInfo("bash", $"-c \"{command}\"") { + ProcessStartInfo psi = new ProcessStartInfo { RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false, - CreateNoWindow = true + CreateNoWindow = true, + FileName = command }; Process process = new Process { StartInfo = psi }; From 65b3299b39c39ebed69846579612ab7821821a5a Mon Sep 17 00:00:00 2001 From: Kamalpreet Kaur Date: Fri, 3 Jan 2025 16:39:59 +0530 Subject: [PATCH 2/3] fix: runShellCommand --- BrowserStackLocal/BrowserStackLocal/BrowserStackTunnel.cs | 2 +- BrowserStackLocal/BrowserStackLocal/Util.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/BrowserStackLocal/BrowserStackLocal/BrowserStackTunnel.cs b/BrowserStackLocal/BrowserStackLocal/BrowserStackTunnel.cs index 3b217d7..1d694be 100644 --- a/BrowserStackLocal/BrowserStackLocal/BrowserStackTunnel.cs +++ b/BrowserStackLocal/BrowserStackLocal/BrowserStackTunnel.cs @@ -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) diff --git a/BrowserStackLocal/BrowserStackLocal/Util.cs b/BrowserStackLocal/BrowserStackLocal/Util.cs index 235d8ea..56b2ddd 100644 --- a/BrowserStackLocal/BrowserStackLocal/Util.cs +++ b/BrowserStackLocal/BrowserStackLocal/Util.cs @@ -6,14 +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 { RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false, CreateNoWindow = true, - FileName = command + FileName = command, + Arguments = args }; Process process = new Process { StartInfo = psi }; From 06e496a815759c48aea161318ba6947beedaae90 Mon Sep 17 00:00:00 2001 From: Kamalpreet Kaur Date: Fri, 3 Jan 2025 17:03:02 +0530 Subject: [PATCH 3/3] fix: alpine shell command --- BrowserStackLocal/BrowserStackLocal/BrowserStackTunnel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BrowserStackLocal/BrowserStackLocal/BrowserStackTunnel.cs b/BrowserStackLocal/BrowserStackLocal/BrowserStackTunnel.cs index 1d694be..40ed6c1 100644 --- a/BrowserStackLocal/BrowserStackLocal/BrowserStackTunnel.cs +++ b/BrowserStackLocal/BrowserStackLocal/BrowserStackTunnel.cs @@ -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)