From 8b65bfd5d610a70e1a860936be1a47f3a3df7f32 Mon Sep 17 00:00:00 2001 From: Gar Date: Tue, 29 Mar 2022 07:05:29 -0700 Subject: fix: return otplease fn results --- lib/utils/otplease.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/utils/otplease.js b/lib/utils/otplease.js index 566c24ef2..83985b6bc 100644 --- a/lib/utils/otplease.js +++ b/lib/utils/otplease.js @@ -1,17 +1,17 @@ -const readUserInfo = require('./read-user-info.js') - -module.exports = otplease async function otplease (opts, fn) { try { - await fn(opts) + return await fn(opts) } catch (err) { + const readUserInfo = require('./read-user-info.js') if (err.code !== 'EOTP' && (err.code !== 'E401' || !/one-time pass/.test(err.body))) { throw err } else if (!process.stdin.isTTY || !process.stdout.isTTY) { throw err } else { const otp = await readUserInfo.otp('This operation requires a one-time password.\nEnter OTP:') - return fn({ ...opts, otp }) + return await fn({ ...opts, otp }) } } } + +module.exports = otplease -- cgit v1.2.3