agent: Refactor main function

Move the sandbox creation into a new function.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
James O. D. Hunt 2020-08-20 15:43:13 +01:00
parent bac79eeef0
commit 1b2fe4a5be

View File

@ -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();
}