Skip to content

Commit 7ef8681

Browse files
committed
chore: moved args generation outside loop. fix: await for async call
1 parent 88148a2 commit 7ef8681

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

setup-local/dist/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ class BinaryControl {
12391239
try {
12401240
await this._makeDirectory();
12411241
core.debug('BrowserStackLocal binary not found in cache. Deleting any stale/existing binary before downloading...');
1242-
this._removeAnyStaleBinary();
1242+
await this._removeAnyStaleBinary();
12431243

12441244
core.info('Downloading BrowserStackLocal binary...');
12451245
const downloadPath = await tc.downloadTool(
@@ -1259,6 +1259,7 @@ class BinaryControl {
12591259
* Starts Local Binary using the args generated for this action
12601260
*/
12611261
async startBinary() {
1262+
this._generateArgsForBinary();
12621263
let { localIdentifier } = this.stateForBinary;
12631264
localIdentifier = localIdentifier ? `with local-identifier=${localIdentifier}` : '';
12641265
core.info(`Starting local tunnel ${localIdentifier} in daemon mode...`);
@@ -1267,8 +1268,6 @@ class BinaryControl {
12671268

12681269
while (triesAvailable--) {
12691270
try {
1270-
this._generateArgsForBinary();
1271-
12721271
// eslint-disable-next-line no-await-in-loop
12731272
const { output, error } = await this._triggerBinary(LOCAL_TESTING.START);
12741273

@@ -1299,8 +1298,8 @@ class BinaryControl {
12991298
* Stops Local Binary using the args generated for this action
13001299
*/
13011300
async stopBinary() {
1301+
this._generateArgsForBinary();
13021302
try {
1303-
this._generateArgsForBinary();
13041303
let { localIdentifier } = this.stateForBinary;
13051304
localIdentifier = localIdentifier ? `with local-identifier=${localIdentifier}` : '';
13061305
core.info(`Stopping local tunnel ${localIdentifier} in daemon mode...`);

setup-local/src/binaryControl.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class BinaryControl {
174174
try {
175175
await this._makeDirectory();
176176
core.debug('BrowserStackLocal binary not found in cache. Deleting any stale/existing binary before downloading...');
177-
this._removeAnyStaleBinary();
177+
await this._removeAnyStaleBinary();
178178

179179
core.info('Downloading BrowserStackLocal binary...');
180180
const downloadPath = await tc.downloadTool(
@@ -194,6 +194,7 @@ class BinaryControl {
194194
* Starts Local Binary using the args generated for this action
195195
*/
196196
async startBinary() {
197+
this._generateArgsForBinary();
197198
let { localIdentifier } = this.stateForBinary;
198199
localIdentifier = localIdentifier ? `with local-identifier=${localIdentifier}` : '';
199200
core.info(`Starting local tunnel ${localIdentifier} in daemon mode...`);
@@ -202,8 +203,6 @@ class BinaryControl {
202203

203204
while (triesAvailable--) {
204205
try {
205-
this._generateArgsForBinary();
206-
207206
// eslint-disable-next-line no-await-in-loop
208207
const { output, error } = await this._triggerBinary(LOCAL_TESTING.START);
209208

@@ -234,8 +233,8 @@ class BinaryControl {
234233
* Stops Local Binary using the args generated for this action
235234
*/
236235
async stopBinary() {
236+
this._generateArgsForBinary();
237237
try {
238-
this._generateArgsForBinary();
239238
let { localIdentifier } = this.stateForBinary;
240239
localIdentifier = localIdentifier ? `with local-identifier=${localIdentifier}` : '';
241240
core.info(`Stopping local tunnel ${localIdentifier} in daemon mode...`);

0 commit comments

Comments
 (0)