From: Chris Duncan Date: Tue, 11 Mar 2025 21:05:04 +0000 (-0700) Subject: Fix command arguments being popped one too many times. X-Git-Tag: v3.1.0~9^2~14 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=f9e2f636b908e134446f90056eaf827302c96d0a;p=nano-pow.git Fix command arguments being popped one too many times. --- diff --git a/cli.js b/cli.js index e8e7f31..5656b87 100755 --- a/cli.js +++ b/cli.js @@ -7,10 +7,8 @@ import * as fs from 'node:fs/promises' const args = process.argv.slice(2) const hashes = [] -let hash = args.pop() -while (/^[0-9A-Fa-f]{64}$/.test(hash ?? '')) { - hashes.unshift(hash) - hash = args.pop() +while (/^[0-9A-Fa-f]{64}$/.test(args[args.length - 1] ?? '')) { + hashes.unshift(args.pop()) } if (hashes.length === 0) { console.error('Invalid block hash input')