Don't start authfs until fd_server is ready
We pass a pipe fd to fd_server which it closes when it is ready to
accept connections. pvm_exec waits for this before triggering
compilation, which will cause authfs in the VM to connect back to
fd_server.
Also improved a bunch of error handling/error logging code, since I
managed to hit a lot of failure cases.
Fix: 201764092
Bug: 186126194
Test: atest ComposTestCase
Change-Id: I99ea5ba4fb390d47485aef3cbaaccedd046ae9fe
diff --git a/compos/src/compsvc_main.rs b/compos/src/compsvc_main.rs
index 388e79b..d0c920a 100644
--- a/compos/src/compsvc_main.rs
+++ b/compos/src/compsvc_main.rs
@@ -43,7 +43,14 @@
/// The CID representing the host VM
const VMADDR_CID_HOST: u32 = 2;
-fn main() -> Result<()> {
+fn main() {
+ if let Err(e) = try_main() {
+ error!("failed with {:?}", e);
+ std::process::exit(1);
+ }
+}
+
+fn try_main() -> Result<()> {
let args = clap::App::new("compsvc")
.arg(clap::Arg::with_name("log_to_stderr").long("log_to_stderr"))
.get_matches();