You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c9e79b8
Browse filesBrowse the repository at this point in the historyBrowse files
LOC-7420: tolerate a busy binary instead of crashing the consumer
On Windows, BrowserStackLocal.exe in ~/.browserstack is routinely
unopenable for a moment -- an AV scan of a freshly written executable, a
tunnel still releasing its handle, two workers starting at once. POSIX
allows opening and unlinking a file in use, so this only shows on
Windows. Several defects turned that transient condition into a crash
before any session started.
1. download.js and LocalBinary.js registered the write-stream 'error'
handler inside the async https.get callback. createWriteStream emits
on the next tick, long before that runs, so the error had no listener
and node's `throw er` killed the download child. Handlers now attach
immediately after createWriteStream.
Handling the error is not enough on its own: the request is still in
flight, and without destroying it the child keeps downloading into a
dead stream while the parent's spawnSync blocks for a full download
before it can retry. The throw was also stopping the download.
2. retryBinaryDownload did its work in an async callback, so the sync
path returned undefined to a caller that had already given up --
surfacing as "Couldn't find binary file" while the retries ran on,
orphaned, in the background. This happened even when the unlink
succeeded, so it is not a consequence of the EPERM.
3. Retrying instantly against a live lock just burns the retry budget,
so a busy binary is now probed and waited on, bounded, rather than
deleted. Follows the CLI binary's existing busy-code handling.
4. spawnSync reports spawn failures via obj.error, leaving stdout null;
reading .length threw a TypeError that replaced the real cause.
execFile raises the same class of failure synchronously, where an
uncaught throw inside the getBinaryPath callback killed the
consumer's process outright. Both are handled now.
Tests force the open to fail rather than reproducing a lock, since the
defect is any createWriteStream failure rather than EBUSY specifically,
so they need no Windows runner, network or credentials.
.eslintrc.json moves to es2017 for Atomics/SharedArrayBuffer.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments