summaryrefslogtreecommitdiff
path: root/geheim.rb
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2023-09-09 11:37:39 +0300
committerPaul Buetow <paul@buetow.org>2023-09-09 11:37:39 +0300
commitc607fb2599fa399d104bc834d905840a0d553cfb (patch)
treec72e11fde7fb5e26b36b05580aebbbce023f46e5 /geheim.rb
parentb43263e8112f8873359ae8b81da926c2ff28b8ab (diff)
Fix shred exit code
Diffstat (limited to 'geheim.rb')
-rwxr-xr-xgeheim.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/geheim.rb b/geheim.rb
index 875e6fb..2437bdb 100755
--- a/geheim.rb
+++ b/geheim.rb
@@ -486,15 +486,21 @@ class Geheim
def shred_all_exported
log 'Shredding all exported files'
+ ec = 0
Dir.glob("#{Config.export_dir}/*").each do |file|
- shred_file(file: file)
+ next unless File.file?(file)
+
+ if (ec_ = shred_file(file: file)).positive?
+ ec = ec_
+ end
end
+ ec
end
private
def shred_file(file:, delay: 0)
- sleep(delay) if delay > 0
+ sleep(delay) if delay.positive?
`which shred`
if $?.success?
run_command("shred -vu #{file}")
@@ -530,6 +536,7 @@ class Geheim
def run_command(cmd)
log "#{cmd}: #{`#{cmd}`}"
+ $?.exitstatus
end
def walk_indexes(search_term: nil)