mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[GH-ISSUE #1160] Allow printing to stdout when log-file is not set (and command did not fail) #819
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#819
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @0x07cf-dev on GitHub (Jul 26, 2024).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1160
💡 Idea
Commands such as
ntfy token listalways write to stderr, even when return code is zero and therefore the execution succesful.Reading through the logging section of the documentation, I found that if a logging file isn't specified (like in my case) then ntfy will start logging to the console, to stderr by default. But why shouldn't it log successful command outputs and results to stdout instead?
The relevant code appears to be on this line, for the token command.
Searching the repo for
c.App.Writeryields two results, whereasc.App.ErrWriterappears to be widely and intentionally used.As there could be important reasons for this to be the default behaviour, I am not creating a bug report / pull request.
I ran:
As you can see, listing tokens for non-existing users works as expected. It's an error, so the code 1 is returned and nothing is written to stdout.
On the other hand, listing tokens for existing users (or all tokens, for that matter) does not:
💻 Target components
ntfy-cli
🔮 Additional context
ntfy 2.11.0 (
d11b100), runtime go1.22.2