commit fd08e3cd52319a13dd5947287064805f2c90942d
parent eb430028f4df30b11f60c9200e8e769d6722cbb8
Author: Nihal Jere <nihal@nihaljere.xyz>
Date: Tue, 28 Sep 2021 11:55:34 -0500
npm-agent: cache password only if npm-core is successful
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/npm-agent.c b/npm-agent.c
@@ -201,6 +201,7 @@ set_timer()
int
agent()
{
+ int status;
fprintf(stderr, "%s\n", __func__);
if (!cached) {
@@ -208,7 +209,10 @@ agent()
set_timer();
}
- run_core();
+ // if the password is wrong, we don't cache it
+ if (status = run_core()) {
+ clear_encryptor();
+ }
}
bool running = true;