Skip to content

Commit 0d13cfa

Browse files
authored
Merge pull request #51 from browserstack/alpine-fix
fix: runShellCommand
2 parents 5bfd594 + 06e496a commit 0d13cfa

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

BrowserStackLocal/BrowserStackLocal/BrowserStackTunnel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static bool IsAlpine()
5757
{
5858
try
5959
{
60-
string[] output = Util.RunShellCommand("grep -w 'NAME' /etc/os-release");
60+
string[] output = Util.RunShellCommand("grep", "-w \'NAME\' /etc/os-release");
6161
return output[0]?.ToLower()?.Contains("alpine") ?? false;
6262
}
6363
catch (System.Exception ex)

BrowserStackLocal/BrowserStackLocal/Util.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ namespace BrowserStack
66
public class Util {
77

88
// Only Unix Support
9-
public static string[] RunShellCommand(string command)
9+
public static string[] RunShellCommand(string command, string args = "")
1010
{
11-
ProcessStartInfo psi = new ProcessStartInfo("bash", $"-c \"{command}\"") {
11+
ProcessStartInfo psi = new ProcessStartInfo {
1212
RedirectStandardOutput = true,
1313
RedirectStandardError = true,
1414
UseShellExecute = false,
15-
CreateNoWindow = true
15+
CreateNoWindow = true,
16+
FileName = command,
17+
Arguments = args
1618
};
1719

1820
Process process = new Process { StartInfo = psi };

0 commit comments

Comments
 (0)