microdroid_manager: waits for a config file

Ideally, microdroid_manager should start zipfuse only if necessary and
access the VM config file from the APK via fusefs when it's ready.

But for now zipfuse doesn't report when it's ready to access files in a
zip file. So, microdroid_manager should wait a while to access the
config file when it is from the APK.

Bug: 189301496
Test: MicrodroidHostTestCases
Test: microdroid_manager_test
Change-Id: I0dc304a8f135f52a846fc1bb6f4e476f6162697a
diff --git a/microdroid_manager/src/main.rs b/microdroid_manager/src/main.rs
index 4f87a40..fbbe8f3 100644
--- a/microdroid_manager/src/main.rs
+++ b/microdroid_manager/src/main.rs
@@ -14,6 +14,7 @@
 
 //! Microdroid Manager
 
+mod ioutil;
 mod payload_config;
 mod signature;
 
@@ -21,7 +22,8 @@
 use log::{info, Level};
 use payload_config::{Task, VmPayloadConfig};
 use std::io;
-use std::process::Command;
+use std::path::Path;
+use std::process::{Command, Stdio};
 
 const LOG_TAG: &str = "MicrodroidManager";
 
@@ -32,7 +34,7 @@
 
     let signature = signature::load()?;
     if !signature.payload_config_path.is_empty() {
-        let config = VmPayloadConfig::load_from(&signature.payload_config_path)?;
+        let config = VmPayloadConfig::load_from(Path::new(&signature.payload_config_path))?;
         if let Some(main_task) = &config.task {
             exec(main_task)?;
         }
@@ -45,7 +47,8 @@
 /// TODO(jooyung): fork a child process
 fn exec(task: &Task) -> io::Result<()> {
     info!("executing main task {} {:?}...", task.command, task.args);
-    let exit_status = Command::new(&task.command).args(&task.args).status()?;
+    let exit_status =
+        Command::new(&task.command).args(&task.args).stdout(Stdio::inherit()).status()?;
     info!("exit with {}", &exit_status);
     Ok(())
 }