Quantcast
Channel: [EN] OpenPLi Third-Party Development
Viewing all articles
Browse latest Browse all 1688

Error handling in eConsoleAppContainer

$
0
0

There are some problems with error handling in eConsoleAppContainer.

  1. If the execvp() call in bidirpipe() returns (e.g. fails with ENOENT or EPERM), the child process prints "[eConsoleAppContainer] Finished <cmdname>" to the debug log when it was actually not possible to run the command, and exits the child process with status 0, when it should exit the child with non-zero status. Exiting with status 127 would be compatible with the status returned from "sh -c" when the command isn't found.
  2. If the child is terminated with a signal, the appClosed() PSignal1 is invoked with a retval of 0, unless the process was terminated by a SIGKILL that was sent by eConsoleAppContainer::kill(). If the child is terminated by a SIGKILL from any other source, retval is 0. Similarly retval is 0 if the child is terminated by SIGINT, even if the SIGINT was sent by eConsoleAppContainer::sendCtrlC().

I propose that if the execvp() call in bidirpipe() returns, the message printed to the debug lok should be something like "[eConsoleAppContainer] <cmdname> failed to execute: <perror string>", and the call of _exit() shoud be changed from _exit(0) to _exit(127).

 

I think that the retval argument to the appClosed() PSignal1 should be the child's exit status if the child exited normally, and -signalvalue if the child was terminated by a signal. I have run through most of the uses of eConsoleAppContainer in the Beyonwiz enigma2 code and I can't see any problem with this change (retval is mostly ignored or tested for being non-zero). The only issue I see is if there is code that explicitly tests for retval == -1 to detect termination of the child by eConsoleAppContainer::kill().


Viewing all articles
Browse latest Browse all 1688

Trending Articles