Add option in aos::starter::Application to run as sudo

Previously, the user needed to instantiate the class object with "sudo"
and pass in the name of the actual application as an argument. This was
not very intuitive to readers and maintainers.

Change-Id: I98cd60017babcf345fc66a7a46d9329e96ae00ab
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/starter/subprocess.h b/aos/starter/subprocess.h
index bacc574..87479e8 100644
--- a/aos/starter/subprocess.h
+++ b/aos/starter/subprocess.h
@@ -87,6 +87,7 @@
   void set_args(std::vector<std::string> args);
   void set_capture_stdout(bool capture);
   void set_capture_stderr(bool capture);
+  void set_run_as_sudo(bool value) { run_as_sudo_ = value; }
 
   bool autostart() const { return autostart_; }
 
@@ -106,6 +107,9 @@
 
  private:
   typedef aos::util::ScopedPipe::PipePair PipePair;
+
+  static constexpr const char* const kSudo{"sudo"};
+
   void set_args(
       const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>
           &args);
@@ -140,6 +144,7 @@
   std::string user_name_;
   std::optional<uid_t> user_;
   std::optional<gid_t> group_;
+  bool run_as_sudo_ = false;
 
   bool capture_stdout_ = false;
   PipePair stdout_pipes_;