Fix broken BrowserStackLocal binary after first test #242
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.
Currently after installing browserstack-runner you can run one test.
After that, the command is broken. There are numerous symptoms
from this:
Here is what happens on later runs:
fs.exists(localBinary)
finds the binary.runTunnelCmd(['-version'])
gets the following output:subProcess.stdout.on('data')
./version\s+(\d)/
. It reports:Tunnel binary: found version null
.callbackOnce()
and will try to kill the process. This may succeed, but it is not immediate as there are additional output lines still in the data buffer which must be processed first, which is not possible since we are still indirectly in the call stack of the firstdata
stdout callback.Error: ETXTBSY: text file is busy
.All of this happens only because
-version
is interpreted as both-v
for verbose and--version
at the same time, the verbose output comes first and does not match the regex. Changing it to--version
solves the problem.This code should also be changed so that it actually waits for this subprocess to exit. Perhaps falling back to unlinking the file if we can't close it so that at least the redownload will work. But, that is another issue and will not be a problem in most cases.
Fixes #224.