mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-11 14:30:03 +00:00
Investigate incorrect target detection (#1376)
* detect-targets: add debug tracing See #1375. * Add new feature `tracing` & `cli-tracing` to `detect-targets Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix clippy lints Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> --------- Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
680accd0d3
commit
2db8e254bc
7 changed files with 49 additions and 12 deletions
|
@ -7,6 +7,8 @@ use std::{
|
|||
|
||||
use cfg_if::cfg_if;
|
||||
use tokio::process::Command;
|
||||
#[cfg(feature = "tracing")]
|
||||
use tracing::debug;
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(target_os = "linux")] {
|
||||
|
@ -32,10 +34,14 @@ cfg_if! {
|
|||
/// Check [this issue](https://github.com/ryankurte/cargo-binstall/issues/155)
|
||||
/// for more information.
|
||||
pub async fn detect_targets() -> Vec<String> {
|
||||
let target = get_target_from_rustc().await.unwrap_or_else(|| {
|
||||
guess_host_triple::guess_host_triple()
|
||||
.unwrap_or(crate::TARGET)
|
||||
.to_string()
|
||||
let target = get_target_from_rustc().await;
|
||||
#[cfg(feature = "tracing")]
|
||||
debug!("get_target_from_rustc()={target:?}");
|
||||
let target = target.unwrap_or_else(|| {
|
||||
let target = guess_host_triple::guess_host_triple();
|
||||
#[cfg(feature = "tracing")]
|
||||
debug!("guess_host_triple::guess_host_triple()={target:?}");
|
||||
target.unwrap_or(crate::TARGET).to_string()
|
||||
});
|
||||
|
||||
cfg_if! {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue