Add support for capturing stdout/err in Application

This also makes it so that the Application object can poll instead of
just relying on SIGCHLD to watch for application stops, to make it a bit
cleaner for simple use-cases.

Change-Id: I8af71e1dd89e0cfa1b189ba1e5264df0df9b9560
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/util/scoped_pipe.h b/aos/util/scoped_pipe.h
index 6716fb5..fb91e02 100644
--- a/aos/util/scoped_pipe.h
+++ b/aos/util/scoped_pipe.h
@@ -3,8 +3,8 @@
 
 #include <stdint.h>
 
+#include <memory>
 #include <optional>
-#include <tuple>
 
 #include "absl/types/span.h"
 
@@ -16,11 +16,18 @@
   class ScopedReadPipe;
   class ScopedWritePipe;
 
-  static std::tuple<ScopedReadPipe, ScopedWritePipe> MakePipe();
+  struct PipePair {
+    std::unique_ptr<ScopedReadPipe> read;
+    std::unique_ptr<ScopedWritePipe> write;
+  };
+
+  static PipePair MakePipe();
 
   virtual ~ScopedPipe();
 
   int fd() const { return fd_; }
+  // Sets FD_CLOEXEC on the file descriptor.
+  void SetCloexec();
 
  private:
   ScopedPipe(int fd = -1);