summaryrefslogtreecommitdiff
path: root/v-i
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-07-08 16:44:37 +0300
committerLars Wirzenius <liw@liw.fi>2023-07-08 16:44:37 +0300
commit005d712d988425c7c5387a8d82ae4d4844ac2243 (patch)
treea51dd81ab28b1913497c585ef26fb798863ae57d /v-i
parentd9bdbb09c08e3a9e516bb6bedd2ce722a5240e85 (diff)
downloadv-i-005d712d988425c7c5387a8d82ae4d4844ac2243.tar.gz
fix: discard blocks securely when possible, otherwise insecurely
Sponsored-by: author
Diffstat (limited to 'v-i')
-rwxr-xr-xv-i10
1 files changed, 9 insertions, 1 deletions
diff --git a/v-i b/v-i
index f2615bc..a366249 100755
--- a/v-i
+++ b/v-i
@@ -34,7 +34,15 @@ def error(msg):
def run(argv, **kwargs):
log(f"RUN: {argv} {kwargs}")
- return subprocess.run(argv, **kwargs)
+ check = False
+ if "check" in kwargs:
+ check = True
+ del kwargs["check"]
+ p = subprocess.run(argv, **kwargs)
+ if check and p.returncode != 0:
+ error(f"Ran command that failed: {argv}\n{p.stderr.decode()}")
+ sys.exit("command failed")
+ return p
def physical_volumes():