saucelabs / node-saucelabs

A wrapper around Sauce Labs API
Apache License 2.0
93 stars 44 forks source link

[sauceConnectLoader] we should await fs.rename & fs.chmod to avoid race conditions #241

Closed naruaway closed 3 months ago

naruaway commented 6 months ago

[sauceConnectLoader] we should await fs.rename & fs.chmod to avoid race conditions

Description

saucelabs npm package downloads sc binary via verifyAlreadyDownloaded async function before actually invoking it. However, some of the file system operations are not properly awaited so if they are slow, spawn can happen before making sure sc binary is ready in the correct path.

Note that this type of bugs are easily detected by static checks if we use TypeScript + ESLint (no-floating-promises is part of recommended-type-checked)

Types of Changes

What types of changes does your code introduce? Keep the ones that apply:

Tasks

List of tasks you will do to complete the PR

Review

List of tasks the reviewer must do to review the PR

Deployment Notes

These should highlight any db migrations, feature toggles, etc.

Nothing to care