chowder / duck-gen

Generate Private Duck Addresses from your command-line
MIT License
16 stars 2 forks source link

edit main.go: getToken: fail earlier when scanning stdin fails #3

Closed realtime-neil closed 1 year ago

realtime-neil commented 1 year ago

Granted, when ~/.duck_token is missing, duck-gen must prompt the caller. A non-interactive execution fails like this:

$ nohup duck-gen >duck-gen.errout
nohup: ignoring input and redirecting stderr to stdout
$ cat duck-gen.errout
Enter your Duck Address: Enter the one-time passphrase sent to your email: Could not get Duck token:  could not login: getLogin returned 401 Unauthorized

With this patch, we can fail faster:

$ go build && nohup ./duck-gen >duck-gen.errout ; cat duck-gen.errout
nohup: ignoring input and redirecting stderr to stdout
Enter your Duck Address: Could not get Duck token:  could not get duck address