clicon / clixon

YANG-based toolchain including NETCONF and RESTCONF interfaces and an interactive CLI
http://www.clicon.org/
Other
212 stars 71 forks source link

Error message stucks in stdout buffer #424

Closed vvsosed closed 1 year ago

vvsosed commented 1 year ago

Recently I encountered an issue where if I enter a wrong command in CLI then an error message doesn't appear. But if I execute the right command I will see the error message from the previous command and the output for the next executed command. So it looks like the next valid command pushes out the error message. I suspect that the method clicon_parse(...) from clicon_parse has an issue. If we run the clixon CLI with parameter "-l o" it means that inside the clicon_parse all error messages will be written in stdout. It's causing the issue because stdout is buffered, unlike stderr. Should we use the fflush(f) call for the selected stream at the end of the clicon_parse method?

Also because the method chooses where to write the error messages (in stderr or in stdout) some parts continue to use stderr invariably. Is it a mistake or not?

vvsosed commented 1 year ago

I also made the PR to clarify what I told you about: https://github.com/clicon/clixon/pull/425

olofhagsand commented 1 year ago

merged PR into master. Please verify that it works as expected