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 {
40
40
} else if (osname .contains ("mac" ) || osname .contains ("darwin" )) {
41
41
binFileName = "BrowserStackLocal-darwin-x64" ;
42
42
} 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
+ }
45
49
} else {
46
50
throw new LocalException ("Failed to detect OS type" );
47
51
}
48
52
49
53
httpPath = BIN_URL + binFileName ;
50
54
}
51
55
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
+
52
68
private void checkBinary () throws LocalException {
53
69
boolean binaryWorking = validateBinary ();
54
70
You can’t perform that action at this time.
0 commit comments