mirror of
https://github.com/gaschz/qubes-pass.git
synced 2025-06-07 01:38:31 +02:00
Devnull the thing.
This commit is contained in:
parent
48613008a5
commit
770e0bb76c
12
bin/qvm-pass
12
bin/qvm-pass
@ -378,6 +378,10 @@ def mlockall():
|
|||||||
raise Exception("cannot lock memmory, errno=%s" % ctypes.get_errno())
|
raise Exception("cannot lock memmory, errno=%s" % ctypes.get_errno())
|
||||||
|
|
||||||
|
|
||||||
|
def devnull():
|
||||||
|
return open(os.devnull, "w")
|
||||||
|
|
||||||
|
|
||||||
# -------------------- Begin ----------------------
|
# -------------------- Begin ----------------------
|
||||||
|
|
||||||
|
|
||||||
@ -434,7 +438,7 @@ elif opts.subcommand == "show":
|
|||||||
sys.exit(pass_read("get", opts.key))
|
sys.exit(pass_read("get", opts.key))
|
||||||
elif opts.subcommand in ("mv", "cp"):
|
elif opts.subcommand in ("mv", "cp"):
|
||||||
if not opts.force and sys.stdin.isatty():
|
if not opts.force and sys.stdin.isatty():
|
||||||
with open(os.devnull, "w") as null:
|
with devnull() as null:
|
||||||
if pass_read("get", opts.new, stdout=null, stderr=null) == 0:
|
if pass_read("get", opts.new, stdout=null, stderr=null) == 0:
|
||||||
sys.stderr.write("%s: overwrite %s? " % (opts.subcommand, opts.new))
|
sys.stderr.write("%s: overwrite %s? " % (opts.subcommand, opts.new))
|
||||||
sys.stdin.read(1)
|
sys.stdin.read(1)
|
||||||
@ -445,7 +449,7 @@ elif opts.subcommand == "init":
|
|||||||
sys.exit(pass_manage(opts.subcommand, *opts.gpgid))
|
sys.exit(pass_manage(opts.subcommand, *opts.gpgid))
|
||||||
elif opts.subcommand == "rm":
|
elif opts.subcommand == "rm":
|
||||||
if not opts.force and sys.stdin.isatty():
|
if not opts.force and sys.stdin.isatty():
|
||||||
with open(os.devnull, "w") as null:
|
with devnull() as null:
|
||||||
if pass_read("get", opts.key, stdout=null, stderr=null) == 0:
|
if pass_read("get", opts.key, stdout=null, stderr=null) == 0:
|
||||||
sys.stderr.write(
|
sys.stderr.write(
|
||||||
"Are you sure you would like to delete %s? [y/N] " % (opts.key,)
|
"Are you sure you would like to delete %s? [y/N] " % (opts.key,)
|
||||||
@ -476,7 +480,7 @@ elif opts.subcommand in ("get-or-generate", "generate"):
|
|||||||
clipqrcodeexit(opts, stdout)
|
clipqrcodeexit(opts, stdout)
|
||||||
sys.exit(ret)
|
sys.exit(ret)
|
||||||
|
|
||||||
with open(os.devnull, "w") as null:
|
with devnull() as null:
|
||||||
ret, stdout = pass_read("get", opts.key, return_stdout=True, stderr=null)
|
ret, stdout = pass_read("get", opts.key, return_stdout=True, stderr=null)
|
||||||
|
|
||||||
if ret == 8:
|
if ret == 8:
|
||||||
@ -504,7 +508,7 @@ elif opts.subcommand in ("get-or-generate", "generate"):
|
|||||||
sys.exit(ret)
|
sys.exit(ret)
|
||||||
elif opts.subcommand == "insert":
|
elif opts.subcommand == "insert":
|
||||||
if not opts.force and sys.stdin.isatty():
|
if not opts.force and sys.stdin.isatty():
|
||||||
with open(os.devnull, "w") as null:
|
with devnull() as null:
|
||||||
ret = pass_read("get", opts.key, stdout=null, stderr=null)
|
ret = pass_read("get", opts.key, stdout=null, stderr=null)
|
||||||
if ret == 0:
|
if ret == 0:
|
||||||
# There. Confirm.
|
# There. Confirm.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user