Why 0 exit code of exec command is an error?


I use consul-template for backup jobs. Everything works fine, but I get an error in the end.
Simple example:

$ consul-template -exec true
2019/09/19 12:25:04.649078 [ERR] (cli) child process died with exit code 0

Is that correct? 0 code means OK, doesn’t it?


Hil @vovka667,

Yes, that’s ok. If you echo the exit status of consul-template after exiting with that message it should show 0, since the exit code of the child process was 0.

Currently consul-template will exit if the child process dies, and the way it knows the child died is via a channel that is primarily used for error handling. Whenever the child dies a message is passed into that channel and the receiving end logs it as an error, even though in this case it isn’t really.

I’ll create a GitHub issue to log that as INFO if the code is 0.



Here is the issue if you are interested in following it or contributing the PR:

Hi @freddygv,

Thanks a lot!