Skip to content

Commit

Permalink
Using bf handle ignore errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bfren committed Oct 28, 2023
1 parent 4439c87 commit 8dc020a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions overlay/etc/nu/scripts/bf-unbound/anchor.nu
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ export def update [] {

# capture output of unbound-anchor executable
let root_key = bf env UNBOUND_ROOT_KEY
let result = do { ^bf-x-as unbound unbound-anchor -v -a $root_key } | complete
let result = { ^bf-x-as unbound unbound-anchor -v -a $root_key } | bf handle -i

# on first run unbound-anchor always returns exit code 1 because the anchor file does not exist -
# even if it goes on to create it successfully
# therefore instead of checking the exit code we check the output of the command, and write an error
# if it does not contain the success message
let success = "success: the anchor is ok"
if $result.stdout !~ $success { bf write error $" .. failed with error: ($result.stdout)." anchor/update }
if $result !~ $success { bf write error $" .. failed with error: ($result)." anchor/update }
}

0 comments on commit 8dc020a

Please sign in to comment.