File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
src/main/java/com/browserstack/local Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -40,15 +40,31 @@ private void initialize() throws LocalException {
4040 } else if (osname .contains ("mac" ) || osname .contains ("darwin" )) {
4141 binFileName = "BrowserStackLocal-darwin-x64" ;
4242 } else if (osname .contains ("linux" )) {
43- String arch = System .getProperty ("os.arch" );
44- binFileName = "BrowserStackLocal-linux-" + (arch .contains ("64" ) ? "x64" : "ia32" );
43+ if (isAlpine ()) {
44+ binFileName = "BrowserStackLocal-alpine" ;
45+ } else {
46+ String arch = System .getProperty ("os.arch" );
47+ binFileName = "BrowserStackLocal-linux-" + (arch .contains ("64" ) ? "x64" : "ia32" );
48+ }
4549 } else {
4650 throw new LocalException ("Failed to detect OS type" );
4751 }
4852
4953 httpPath = BIN_URL + binFileName ;
5054 }
5155
56+ private boolean isAlpine () {
57+ String [] cmd = { "/bin/sh" , "-c" , "grep -w \" NAME\" /etc/os-release" };
58+ try {
59+ Process os = Runtime .getRuntime ().exec (cmd );
60+ BufferedReader stdout = new BufferedReader (new InputStreamReader (os .getInputStream ()));
61+
62+ return stdout .readLine ().contains ("Alpine" );
63+ } catch (Exception e ) {
64+ return false ;
65+ }
66+ }
67+
5268 private void checkBinary () throws LocalException {
5369 boolean binaryWorking = validateBinary ();
5470
You can’t perform that action at this time.
0 commit comments