mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
f168dbb1e3
commit
3ec0d45be7
9 changed files with 21 additions and 23 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -2810,7 +2810,6 @@ dependencies = [
|
|||
"anyhow",
|
||||
"crossterm",
|
||||
"futures",
|
||||
"libc",
|
||||
"md-5",
|
||||
"mlua",
|
||||
"parking_lot",
|
||||
|
|
@ -2859,6 +2858,7 @@ dependencies = [
|
|||
"base64 0.22.0",
|
||||
"crossterm",
|
||||
"futures",
|
||||
"libc",
|
||||
"parking_lot",
|
||||
"regex",
|
||||
"tokio",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ use std::{collections::HashMap, ffi::{OsStr, OsString}, io::{stdout, BufWriter,
|
|||
use anyhow::{anyhow, Result};
|
||||
use tokio::{fs::{self, OpenOptions}, io::{stdin, AsyncReadExt, AsyncWriteExt}};
|
||||
use yazi_config::{OPEN, PREVIEW};
|
||||
use yazi_plugin::external::{self, ShellOpt};
|
||||
use yazi_proxy::{AppProxy, HIDER, WATCHER};
|
||||
use yazi_shared::{fs::{accessible, max_common_root, File, FilesOp, Url}, term::Term, Defer};
|
||||
|
||||
|
|
@ -37,13 +36,14 @@ impl Manager {
|
|||
let _defer2 = Defer::new(|| tokio::spawn(fs::remove_file(tmp.clone())));
|
||||
AppProxy::stop().await;
|
||||
|
||||
let mut child = external::shell(ShellOpt {
|
||||
cmd: (*opener.run).into(),
|
||||
args: vec![OsString::new(), tmp.to_owned().into()],
|
||||
piped: false,
|
||||
orphan: false,
|
||||
})?;
|
||||
child.wait().await?;
|
||||
// FIXME
|
||||
// let mut child = super::shell(ShellOpt {
|
||||
// cmd: (*opener.run).into(),
|
||||
// args: vec![OsString::new(), tmp.to_owned().into()],
|
||||
// piped: false,
|
||||
// orphan: false,
|
||||
// })?;
|
||||
// child.wait().await?;
|
||||
|
||||
let new: Vec<_> = fs::read_to_string(&tmp).await?.lines().map(PathBuf::from).collect();
|
||||
Self::bulk_rename_do(cwd, root, old, new).await
|
||||
|
|
|
|||
|
|
@ -36,5 +36,4 @@ unicode-width = "^0"
|
|||
yazi-prebuild = "0.1.2"
|
||||
|
||||
[target."cfg(unix)".dependencies]
|
||||
libc = "^0"
|
||||
uzers = "^0"
|
||||
|
|
|
|||
2
yazi-plugin/src/external/mod.rs
vendored
2
yazi-plugin/src/external/mod.rs
vendored
|
|
@ -3,7 +3,6 @@ mod fzf;
|
|||
mod highlighter;
|
||||
mod lsar;
|
||||
mod rg;
|
||||
mod shell;
|
||||
mod zoxide;
|
||||
|
||||
pub use fd::*;
|
||||
|
|
@ -11,5 +10,4 @@ pub use fzf::*;
|
|||
pub use highlighter::*;
|
||||
pub use lsar::*;
|
||||
pub use rg::*;
|
||||
pub use shell::*;
|
||||
pub use zoxide::*;
|
||||
|
|
|
|||
|
|
@ -29,5 +29,8 @@ tokio-stream = "^0"
|
|||
# Logging
|
||||
tracing = { version = "^0", features = [ "max_level_debug", "release_max_level_warn" ] }
|
||||
|
||||
[target."cfg(unix)".dependencies]
|
||||
libc = "^0"
|
||||
|
||||
[target.'cfg(not(target_os = "android"))'.dependencies]
|
||||
trash = "^3"
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
mod op;
|
||||
mod process;
|
||||
mod shell;
|
||||
|
||||
pub use op::*;
|
||||
pub use process::*;
|
||||
pub use shell::*;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
use std::ffi::OsString;
|
||||
|
||||
use tokio::sync::oneshot;
|
||||
use yazi_plugin::external::ShellOpt;
|
||||
|
||||
use super::ShellOpt;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ProcessOpOpen {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
use anyhow::Result;
|
||||
use tokio::{io::{AsyncBufReadExt, BufReader}, select, sync::mpsc};
|
||||
use yazi_plugin::external::{self, ShellOpt};
|
||||
use yazi_proxy::{AppProxy, HIDER};
|
||||
use yazi_shared::Defer;
|
||||
|
||||
use super::ProcessOpOpen;
|
||||
use super::{ProcessOpOpen, ShellOpt};
|
||||
use crate::TaskProg;
|
||||
|
||||
pub struct Process {
|
||||
|
|
@ -24,12 +23,8 @@ impl Process {
|
|||
}
|
||||
|
||||
self.prog.send(TaskProg::New(task.id, 0))?;
|
||||
let mut child = external::shell(ShellOpt {
|
||||
cmd: task.cmd,
|
||||
args: task.args,
|
||||
piped: true,
|
||||
..Default::default()
|
||||
})?;
|
||||
let mut child =
|
||||
super::shell(ShellOpt { cmd: task.cmd, args: task.args, piped: true, ..Default::default() })?;
|
||||
|
||||
let mut stdout = BufReader::new(child.stdout.take().unwrap()).lines();
|
||||
let mut stderr = BufReader::new(child.stderr.take().unwrap()).lines();
|
||||
|
|
@ -68,7 +63,7 @@ impl Process {
|
|||
AppProxy::stop().await;
|
||||
|
||||
let (id, cmd) = (task.id, task.cmd.clone());
|
||||
let result = external::shell(task.into());
|
||||
let result = super::shell(task.into());
|
||||
if let Err(e) = result {
|
||||
AppProxy::notify_warn(&cmd.to_string_lossy(), &format!("Failed to spawn process: {e}"));
|
||||
return self.succ(id);
|
||||
|
|
@ -88,7 +83,7 @@ impl Process {
|
|||
|
||||
async fn open_orphan(&self, task: ProcessOpOpen) -> Result<()> {
|
||||
let id = task.id;
|
||||
match external::shell(task.into()) {
|
||||
match super::shell(task.into()) {
|
||||
Ok(_) => self.succ(id)?,
|
||||
Err(e) => {
|
||||
self.prog.send(TaskProg::New(id, 0))?;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue