From 1b2fe4a5bed07d0187695a97ce59781edec9ea9b Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Thu, 20 Aug 2020 15:43:13 +0100 Subject: [PATCH] agent: Refactor main function Move the sandbox creation into a new function. Signed-off-by: James O. D. Hunt --- src/agent/src/main.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/agent/src/main.rs b/src/agent/src/main.rs index de61de035..9349dcfa0 100644 --- a/src/agent/src/main.rs +++ b/src/agent/src/main.rs @@ -195,6 +195,14 @@ fn main() -> Result<()> { // which is required to satisfy the the lifetime constraints of the auto-generated gRPC code. let _guard = slog_scope::set_global_logger(logger.new(o!("subsystem" => "rpc"))); + start_sandbox(&logger, &config)?; + + let _ = log_handle.join(); + + Ok(()) +} + +fn start_sandbox(logger: &Logger, config: &agentConfig) -> Result<()> { let shells = SHELLS.clone(); let debug_console_vport = config.debug_console_vport as u32; @@ -262,8 +270,6 @@ fn main() -> Result<()> { server.shutdown(); - let _ = log_handle.join(); - if config.debug_console { shell_handle.join().unwrap(); }