diff --git a/.changes/fix-capture.md b/.changes/fix-capture.md new file mode 100644 index 00000000..6548b779 --- /dev/null +++ b/.changes/fix-capture.md @@ -0,0 +1,6 @@ +--- +"tauri-mobile": patch +--- + +Fix several commands fail because stdout isn't captured. + diff --git a/src/apple/deps/xcode_plugin.rs b/src/apple/deps/xcode_plugin.rs index 83401cf1..400debe8 100644 --- a/src/apple/deps/xcode_plugin.rs +++ b/src/apple/deps/xcode_plugin.rs @@ -60,12 +60,11 @@ pub fn xcode_user_dir() -> Result { pub fn xcode_developer_dir() -> Result { duct::cmd("xcode-select", ["-p"]) - .run() + .read() .map(|output| { - let stdout = String::from_utf8_lossy(&output.stdout).to_string(); // This output is expected to end with a newline, but we'll err on // the safe side and proceed gracefully if it doesn't. - PathBuf::from(stdout.strip_suffix('\n').unwrap_or(&stdout)) + PathBuf::from(output.strip_suffix('\n').unwrap_or(&output)) }) .map_err(Error::XcodeSelectFailed) } diff --git a/src/apple/teams.rs b/src/apple/teams.rs index 610d8d0f..b23aa657 100644 --- a/src/apple/teams.rs +++ b/src/apple/teams.rs @@ -12,6 +12,7 @@ pub fn get_pem_list(name_substr: &str) -> std::io::Result "security", ["find-certificate", "-p", "-a", "-c", name_substr], ) + .stdout_capture() .run() } diff --git a/src/util/git/repo.rs b/src/util/git/repo.rs index 256b5868..44565e52 100644 --- a/src/util/git/repo.rs +++ b/src/util/git/repo.rs @@ -89,10 +89,12 @@ impl Repo { .map_err(Error::FetchFailed)?; let local = git .command_parse("rev-parse HEAD") + .stdout_capture() .run() .map_err(Error::RevParseLocalFailed)?; let remote = git .command_parse("rev-parse @{u}") + .stdout_capture() .run() .map_err(Error::RevParseRemoteFailed)?; if local.stdout != remote.stdout { diff --git a/src/util/mod.rs b/src/util/mod.rs index 9ff48f78..4db9b4a4 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -477,13 +477,9 @@ pub fn prepend_to_path(path: impl Display, base_path: impl Display) -> String { } pub fn command_present(name: &str) -> Result { - command_path(name).map(|_path| true).or_else(|err| { - if err.raw_os_error().is_some() { - Ok(false) - } else { - Err(err) - } - }) + command_path(name) + .map(|_path| true) + .or_else(|_err| Ok(false)) } #[derive(Debug)]