mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
chore: add more logs to file
This commit is contained in:
parent
96cb7b6cc8
commit
66aecd5402
1 changed files with 4 additions and 0 deletions
4
core/src/external/file.rs
vendored
4
core/src/external/file.rs
vendored
|
|
@ -1,8 +1,10 @@
|
||||||
use std::{collections::BTreeMap, ffi::OsStr, path::PathBuf};
|
use std::{collections::BTreeMap, ffi::OsStr, path::PathBuf};
|
||||||
|
|
||||||
use anyhow::{bail, Result};
|
use anyhow::{bail, Result};
|
||||||
|
use futures::TryFutureExt;
|
||||||
use shared::MimeKind;
|
use shared::MimeKind;
|
||||||
use tokio::process::Command;
|
use tokio::process::Command;
|
||||||
|
use tracing::error;
|
||||||
|
|
||||||
pub async fn file(files: &[impl AsRef<OsStr>]) -> Result<BTreeMap<PathBuf, String>> {
|
pub async fn file(files: &[impl AsRef<OsStr>]) -> Result<BTreeMap<PathBuf, String>> {
|
||||||
if files.is_empty() {
|
if files.is_empty() {
|
||||||
|
|
@ -14,6 +16,7 @@ pub async fn file(files: &[impl AsRef<OsStr>]) -> Result<BTreeMap<PathBuf, Strin
|
||||||
.args(files)
|
.args(files)
|
||||||
.kill_on_drop(true)
|
.kill_on_drop(true)
|
||||||
.output()
|
.output()
|
||||||
|
.inspect_err(|e| error!("failed to execute `file`: {}", e))
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let output = String::from_utf8_lossy(&output.stdout);
|
let output = String::from_utf8_lossy(&output.stdout);
|
||||||
|
|
@ -26,6 +29,7 @@ pub async fn file(files: &[impl AsRef<OsStr>]) -> Result<BTreeMap<PathBuf, Strin
|
||||||
);
|
);
|
||||||
|
|
||||||
if mimes.is_empty() {
|
if mimes.is_empty() {
|
||||||
|
error!("failed to get mime types: {:?}", files.iter().map(AsRef::as_ref).collect::<Vec<_>>());
|
||||||
bail!("failed to get mime types");
|
bail!("failed to get mime types");
|
||||||
}
|
}
|
||||||
Ok(mimes)
|
Ok(mimes)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue