ACINQ / eclair

A scala implementation of the Lightning Network.
Apache License 2.0
1.24k stars 266 forks source link

FIX eclair-cli error code in case of HTTP problem #2798

Closed pgrange closed 10 months ago

pgrange commented 11 months ago

Last command of eclair-cli is a curl piped to jq. In case of an error with the curl command (for instance, eclair service is not running) the error code is swallowed by the pipe which will return the exit code of the last command of the pipe (here, jq).

Setting pipefail ensures that the error code of curl is preserved in case of HTTP issue.

This can come handy, for instance, to check that eclair is not ok:

if eclair-cli getinfo
then
  echo eclair is answering
else
  echo problem communicating with eclair
fi
t-bast commented 11 months ago

Thanks! @sstone can you take a look at this?

codecov-commenter commented 11 months ago

Codecov Report

Merging #2798 (6b76fa5) into master (be4ed3c) will increase coverage by 0.01%. The diff coverage is n/a.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2798 +/- ## ========================================== + Coverage 85.86% 85.87% +0.01% ========================================== Files 216 216 Lines 18177 18177 Branches 786 786 ========================================== + Hits 15607 15609 +2 + Misses 2570 2568 -2 ``` [see 5 files with indirect coverage changes](https://app.codecov.io/gh/ACINQ/eclair/pull/2798/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ACINQ)