From c6da13649de02f94cfbe67ba6f564d54d1d27d4a Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Fri, 16 Jan 2026 16:08:29 -0300 Subject: [PATCH] hopefully eliminate the weird case of cron and githubactions calling nak with an empty stdin and causing it to do nothing. closes https://github.com/fiatjaf/nak/issues/90 --- event.go | 1 + helpers.go | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/event.go b/event.go index 1f351ea..2a3a2b7 100644 --- a/event.go +++ b/event.go @@ -155,6 +155,7 @@ example: os.Exit(3) } } + kr, sec, err := gatherKeyerFromArguments(ctx, c) if err != nil { return err diff --git a/helpers.go b/helpers.go index cda3e96..6ae6e4f 100644 --- a/helpers.go +++ b/helpers.go @@ -46,8 +46,14 @@ var ( ) func isPiped() bool { - stat, _ := os.Stdin.Stat() - return stat.Mode()&os.ModeCharDevice == 0 + stat, err := os.Stdin.Stat() + if err != nil { + panic(err) + } + + mode := stat.Mode() + is := mode&os.ModeCharDevice == 0 + return is } func getJsonsOrBlank() iter.Seq[string] { @@ -76,7 +82,7 @@ func getJsonsOrBlank() iter.Seq[string] { return true }) - if !hasStdin && !isPiped() { + if !hasStdin { yield("{}") }