bug: BrowserStack\Local does not pass along binary_path to BrowserStack\LocalBinary #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One of the arguments accepted by BrowserStack\Local is
binaryPath
. You're supposed to be able to pass the path to an already-downloaded BrowserStackLocal binary.However, currently, when you call
BrowserStack\Local::start(...)
....BrowserStack\LocalBinary::binary_path()
, that searches the list of possible binary locations (which currently does not include thebinaryPath
you passed to BrowserStack\Local), and if it fails to find one in those locations, it downloads one.This patch changes
BrowserStack\Local::start(...)
so that, ifbinaryPath
has been set, it addsbinaryPath
to the top of BrowserStack\LocalBinary list of possible binary locations before it callsBrowserStack\LocalBinary::binary_path()
.You would run into this problem if you're trying to run a BrowserStackLocal inside a Docker container whose image is based on Alpine Linux... which you might do if you're running automated BrowserStack tests in GitHub Actions or GitLab CI/CD.
Basically, Alpine Linux uses the musl library, instead of glibc, so binaries (e.g.: BrowserStackLocal) linked against glibc on "traditional" Linux systems usually don't run on Alpine; and vice-versa. Since BrowserStackLocal v8.1, BrowserStackLocal is available for 64-bit Alpine/musl systems, but it's (rightly) not the default download.
Trying to run a BrowserStackLocal binary linked against glibc when there's only musl available results in a silent failure... Linux can run the ELF binary but it does nothing (except abort with an exit-code indicating failure) because the symbols it was linked against do not exist.
This brings some user stories for this ticket...
... and ...