lshal: Add fqname to debug error messages
If any error comes up when invoking debug, write fqname and the error
message to the error output stream.
Test: manual. Add addPostCommandTask to a HAL that keeps writing to the
fd after debug() finishes. lshal debug terminates with fqname and
the error message `timeout reading from pipe, output may be truncated.`
Fixes: 169247570
Change-Id: Idf8944e3cde08dc86766b144c4a3037cbcf6b3dc
diff --git a/cmds/lshal/PipeRelay.h b/cmds/lshal/PipeRelay.h
index 835016041..bd994b4 100644
--- a/cmds/lshal/PipeRelay.h
+++ b/cmds/lshal/PipeRelay.h
@@ -21,6 +21,8 @@
#include <utils/Errors.h>
#include <utils/RefBase.h>
+#include "NullableOStream.h"
+
namespace android {
namespace lshal {
@@ -28,7 +30,10 @@
* written to the "write"-end of the pair to the specified output stream "os".
*/
struct PipeRelay {
- explicit PipeRelay(std::ostream &os);
+ explicit PipeRelay(std::ostream& os,
+ const NullableOStream<std::ostream>& err,
+ const std::string& interfaceName,
+ const std::string& instanceName);
~PipeRelay();
status_t initCheck() const;