Disable strict host key checking

Strict host key checking can cause scp to hang without
a useful error message.

Change-Id: I8f1907c87117746ce7e0a4e486890bbe4ba860d1
diff --git a/src/device.rs b/src/device.rs
index e030531..ae25859 100644
--- a/src/device.rs
+++ b/src/device.rs
@@ -41,16 +41,29 @@
     if !ssh_config.exists() {
         bail!("ssh config not found at {:?}", ssh_config);
     }
-    let ssh_result = Command::new("scp").arg(if verbose { "-v" } else { "-q" })
+    if verbose {
+        println!("destination_with_address = {}", destination_with_address);
+        println!("ssh_config = {:?}", ssh_config);
+    }
+
+    let mut scp_command = Command::new("scp");
+
+    scp_command.arg(if verbose { "-v" } else { "-q" })
         .arg("-F")
         .arg(ssh_config)
+        .args(&["-o", "UserKnownHostsFile=/dev/null", "-o", "StrictHostKeyChecking=no"])
         .arg(source_path)
-        .arg(destination_with_address)
-        .status()
+        .arg(destination_with_address);
+
+    if verbose {
+        println!("{:?}", scp_command);
+    }
+
+    let scp_result = scp_command.status()
         .chain_err(|| "unable to run scp")?;
 
-    if !ssh_result.success() {
-        bail!("scp failed with error {:?}", ssh_result);
+    if !scp_result.success() {
+        bail!("scp failed with error {:?}", scp_result);
     }
 
     Ok(())
@@ -65,6 +78,7 @@
     let ssh_result = Command::new("ssh").arg("-q")
         .arg("-F")
         .arg(ssh_config)
+        .args(&["-o", "UserKnownHostsFile=/dev/null", "-o", "StrictHostKeyChecking=no"])
         .arg(netaddr)
         .arg(command)
         .status()
diff --git a/src/main.rs b/src/main.rs
index 223dd81..7907f17 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -150,22 +150,39 @@
 
     let fargo_path = fs::canonicalize(std::env::current_exe()?)?;
 
-    let fargo_command = if launch {
-        format!("{} run-on-target --launch", fargo_path.to_str().unwrap())
-    } else {
-        format!("{} run-on-target", fargo_path.to_str().unwrap())
-    };
+    let mut runner_args = vec![fargo_path.to_str()
+                                   .ok_or_else(|| "unable to convert path to utf8 encoding")?];
 
-    let status = Command::new("cargo").env("RUSTC", rust_c_path()?.to_str().unwrap())
+    if verbose {
+        runner_args.push("-v");
+    }
+
+    runner_args.push("run-on-target");
+
+    if launch {
+        runner_args.push("--launch");
+    }
+
+    let fargo_command = runner_args.join(" ");
+
+    if verbose {
+        println!("fargo_command: {:?}", fargo_command);
+    }
+
+    let mut cmd = Command::new("cargo");
+
+    cmd.env("RUSTC", rust_c_path()?.to_str().unwrap())
         .env("CARGO_TARGET_X86_64_UNKNOWN_FUCHSIA_LINKER",
              rust_linker_path(&target_options)?.to_str().unwrap())
         .env("CARGO_TARGET_X86_64_UNKNOWN_FUCHSIA_RUNNER", fargo_command)
         .args(args)
-        .args(target_args)
-        .status()
-        .chain_err(|| "Unable to run cargo")?;
+        .args(target_args);
 
-    Ok(status.success())
+    if verbose {
+        println!("cargo cmd: {:?}", cmd);
+    }
+
+    cmd.status().chain_err(|| "Unable to run cargo").map(|s| s.success())
 }