From 192f38bc211b326e2ef3ce0e061b12e52c9f6677 Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 5 Sep 2019 13:18:19 +0100 Subject: [PATCH] fix: avoid generating names in an infinite loop (#62) * without this fix it will keep generating names for all eternity * fix: without this fix it will keep generating names for all eternity --- src/util/azure/account.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util/azure/account.ts b/src/util/azure/account.ts index ba0102e..de42ac4 100644 --- a/src/util/azure/account.ts +++ b/src/util/azure/account.ts @@ -106,10 +106,11 @@ function checkNameAvailability(client: StorageManagementClient, warn?: boolean) const availability = await client.storageAccounts.checkNameAvailability(account); if (!availability.nameAvailable && warn) { spinner.fail(availability.message || 'chosen name is not available'); + return false; } else { spinner.stop(); + return true; } - return !!availability.nameAvailable; }; }