Add nil-check for file opening in git keyring credentials
This commit is contained in:
parent
8b9fcd9d6f
commit
f06cbc94b1
1 changed files with 2 additions and 2 deletions
|
@ -15,7 +15,7 @@ end
|
||||||
|
|
||||||
if action == "get" then
|
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 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")
|
local password = file:read("all")
|
||||||
if password~="" then
|
if password~="" then
|
||||||
print("password="..password)
|
print("password="..password)
|
||||||
|
@ -25,7 +25,7 @@ if action == "get" then
|
||||||
file:close()
|
file:close()
|
||||||
elseif action == "store" then
|
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 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:write(options.password)
|
||||||
file:close()
|
file:close()
|
||||||
elseif action == "erase" then
|
elseif action == "erase" then
|
||||||
|
|
Loading…
Reference in a new issue