[posix-app] enhance RCP failure info (#3950)

By default, posix-app disables platform region logs. Even when
platform logs are enabled, logs	are sent to syslog without printing to
stderr.

This commit prints error information to	stderr on exit, providing the
user more direct information about failures. This commit also
eliminates the "wait no child process" error message.
This commit is contained in:
Yakun Xu
2019-06-28 00:22:23 -07:00
committed by Jonathan Hui
parent 3fded34be1
commit c826edc0c4
2 changed files with 4 additions and 2 deletions
+2 -2
View File
@@ -171,8 +171,8 @@ void HdlcInterface::Deinit(void)
{
VerifyOrExit(mSockFd != -1);
VerifyOrExit(0 == close(mSockFd), perror("close NCP"));
VerifyOrExit(-1 != wait(NULL), perror("wait NCP"));
VerifyOrExit(0 == close(mSockFd), perror("close RCP"));
VerifyOrExit(-1 != wait(NULL) || errno == ECHILD, perror("wait RCP"));
mSockFd = -1;
+2
View File
@@ -112,6 +112,8 @@ void SuccessOrDie(otError aError)
}
otLogCritPlat("Error: %s", otThreadErrorToString(aError));
// For better user experience.
fprintf(stderr, "Error: %s\r\n", otThreadErrorToString(aError));
exit(exitCode);
}