From f06cbc94b10b7605aa2096421f4ec75a7b3c8f13 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Mon, 3 Apr 2023 15:27:54 +0200 Subject: [PATCH] Add nil-check for file opening in git keyring credentials --- bin/git-credential-keyring | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/git-credential-keyring b/bin/git-credential-keyring index 02a50d7..6a7f87d 100755 --- a/bin/git-credential-keyring +++ b/bin/git-credential-keyring @@ -15,7 +15,7 @@ end if action == "get" then local command = string.format('secret-tool lookup application git username %s host %s', options.username, options.host, options.username, options.host) - local file = io.popen(command, "r") + local file = assert(io.popen(command, "r")) local password = file:read("all") if password~="" then print("password="..password) @@ -25,7 +25,7 @@ if action == "get" then file:close() elseif action == "store" then local command = string.format('secret-tool store --label="git %s@%s" application git username %s host %s', options.username, options.host, options.username, options.host) - local file = io.popen(command, "w") + local file = assert(io.popen(command, "w")) file:write(options.password) file:close() elseif action == "erase" then