Skip to content

Commit 9f23381

Browse files
committed
chore: refactoring
1 parent 2170902 commit 9f23381

File tree

2 files changed

+5
-34
lines changed

2 files changed

+5
-34
lines changed

BrowserStackLocal/BrowserStackLocal/BrowserStackTunnel.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ static bool IsAlpine()
6060
string[] output = Util.RunShellCommand("grep -w 'NAME' /etc/os-release");
6161
return output[0]?.ToLower()?.Contains("alpine") ?? false;
6262
}
63-
catch (System.Exception)
63+
catch (System.Exception ex)
6464
{
65-
return false;
65+
Console.WriteLine("Exception while check isAlpine " + ex);
6666
}
67+
return false;
6768
}
6869

6970
static string GetBinaryName()

BrowserStackLocal/BrowserStackLocal/Util.cs

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
11
using System;
22
using System.Diagnostics;
3-
using System.Runtime.InteropServices;
43

54
namespace BrowserStack
65
{
76
public class Util {
87

9-
// Ref: https://stackoverflow.com/a/336729
10-
[DllImport("kernel32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)]
11-
[return: MarshalAs(UnmanagedType.Bool)]
12-
private static extern bool IsWow64Process(
13-
[In] IntPtr hProcess,
14-
[Out] out bool wow64Process
15-
);
16-
178
// Only Unix Support
189
public static string[] RunShellCommand(string command)
1910
{
@@ -44,34 +35,13 @@ public static string GetUName()
4435
return osName;
4536
}
4637

38+
// Using for Linux Only
4739
public static bool Is64BitOS()
4840
{
4941
#if NET48_OR_GREATER || NETSTANDARD2_0_OR_GREATER || NETCOREAPP3_0_OR_GREATER
5042
return Environment.Is64BitOperatingSystem;
5143
#endif
52-
bool is64BitProcess = IntPtr.Size == 8;
53-
return is64BitProcess || InternalCheckIsWow64();
54-
}
55-
56-
public static bool InternalCheckIsWow64()
57-
{
58-
if ((Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor >= 1) ||
59-
Environment.OSVersion.Version.Major >= 6)
60-
{
61-
using (Process p = Process.GetCurrentProcess())
62-
{
63-
bool retVal;
64-
if (!IsWow64Process(p.Handle, out retVal))
65-
{
66-
return false;
67-
}
68-
return retVal;
69-
}
70-
}
71-
else
72-
{
73-
return false;
74-
}
44+
return true;
7545
}
7646
}
7747
}

0 commit comments

Comments
 (0)