[ffx][starnix] Return exit code directly from plugin

Change-Id: I88fa9d17a02a0ac7e5eaf7750168cfb39cfa9166
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/525332
Fuchsia-Auto-Submit: Matthew Boetger <boetger@google.com>
Reviewed-by: Adam Barth <abarth@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
diff --git a/src/developer/ffx/plugins/starnix/shell/src/lib.rs b/src/developer/ffx/plugins/starnix/shell/src/lib.rs
index 4f096ab..314988c 100644
--- a/src/developer/ffx/plugins/starnix/shell/src/lib.rs
+++ b/src/developer/ffx/plugins/starnix/shell/src/lib.rs
@@ -19,7 +19,10 @@
     "starnix_enabled",
     ManagerProxy = "core/starnix_manager:expose:fuchsia.starnix.developer.Manager"
 )]
-pub async fn shell_starnix(manager_proxy: ManagerProxy, _shell: ShellStarnixCommand) -> Result<()> {
+pub async fn shell_starnix(
+    manager_proxy: ManagerProxy,
+    _shell: ShellStarnixCommand,
+) -> Result<i32> {
     let (controller_proxy, controller_server_end) = create_proxy::<ShellControllerMarker>()?;
     let (sin, cin) =
         fidl::Socket::create(fidl::SocketOpts::STREAM).context("failed to create stdin socket")?;
@@ -83,11 +86,9 @@
     let (copy_result, return_code) = futures::join!(copy_futures, term_event_future);
     copy_result?;
 
-    println!("(Shell exited with code: {})", return_code?);
-
     // Shut down the signal thread.
     handle.close();
     thread.join().expect("thread to shutdown without panic");
 
-    Ok(())
+    return_code
 }