celestiaorg / celestia-app

Celestia consensus node
https://celestiaorg.github.io/celestia-app/
Apache License 2.0
341 stars 281 forks source link

`celestia-appd status` sends output to stderr #3823

Open rootulp opened 1 month ago

rootulp commented 1 month ago

Context

I was wondering why I could never pipe the output of celestia-appd status into jq like this:

celestia-appd status | jq .

Problem

It turns out, celestia-appd status sends output to stderr instead of stdout. To repro:

root@rootulp-arabica:~# celestia-appd status >stdout.txt 2>stderr.txt

root@rootulp-arabica:~# cat stdout.txt

root@rootulp-arabica:~# cat stderr.txt
{"NodeInfo":{"protocol_version":{"p2p":"8","block":"11","app":"2"},"id":"8066c315325974182830634cbf9086de6f5c5e42","listen_addr":"tcp://0.0.0.0:26656","network":"arabica-11","version":"2.1.1-1-g3c860c38","channels":"40202122233038606100","moniker":"node-name","other":{"tx_index":"off","rpc_address":"tcp://127.0.0.1:26657"}},"SyncInfo":{"latest_block_hash":"5FE738C5C861C7A90737CAA6283DC86BD22CFEFB6F20D8599013867208DF061F","latest_app_hash":"97D2F0E29D5193AA70772266E8C51CB97E53B04FF474A9B3413761F41B5A8464","latest_block_height":"1807125","latest_block_time":"2024-08-26T20:00:39.040946298Z","earliest_block_hash":"EF5E3D7EC80B7E9F6AD9EE1F2870D00859238796910133CFC3858CDA90A1EE4F","earliest_app_hash":"569DF84025DFBA9E8DAFE9B7ED774E02A280CE828055BD105066DFE06BC1F7FF","earliest_block_height":"1770001","earliest_block_time":"2024-08-21T23:27:44.509291497Z","catching_up":false},"ValidatorInfo":{"Address":"EFE52D240D92F81A033DB40EBD42AD9C8C6D900D","PubKey":{"type":"tendermint/PubKeyEd25519","value":"0m7QrYxl0XLzmaQx51IcmgF1yS69nTmhZwqkzGL2V6c="},"VotingPower":"0"}}

Proposal

Send celestia-appd status to stdout instead of stderr

rootulp commented 1 month ago

As a temporary workaround I do this:

$ celestia-appd status 2>&1 | jq .