mirror of
https://github.com/watchexec/watchexec.git
synced 2024-09-29 22:51:33 +02:00
Cargo fmt
This commit is contained in:
parent
f045fd45ac
commit
f38e7ab969
20
src/error.rs
20
src/error.rs
@ -33,18 +33,16 @@ impl From<globset::Error> for Error {
|
|||||||
|
|
||||||
impl From<io::Error> for Error {
|
impl From<io::Error> for Error {
|
||||||
fn from(err: io::Error) -> Self {
|
fn from(err: io::Error) -> Self {
|
||||||
Self::Io(
|
Self::Io(match err.raw_os_error() {
|
||||||
match err.raw_os_error() {
|
Some(os_err) => match os_err {
|
||||||
Some(os_err) => match os_err {
|
7 => {
|
||||||
7 => {
|
let msg = "There are so many changed files that the environment variables of the child process have been overrun. Try running with --no-meta or --no-environment.";
|
||||||
let msg = "There are so many changed files that the environment variables of the child process have been overrun. Try running with --no-meta or --no-environment.";
|
io::Error::new(io::ErrorKind::Other, msg)
|
||||||
io::Error::new(io::ErrorKind::Other, msg)
|
|
||||||
},
|
|
||||||
_ => err,
|
|
||||||
}
|
}
|
||||||
None => err,
|
_ => err,
|
||||||
}
|
},
|
||||||
)
|
None => err,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
use globset::{GlobBuilder, GlobSet, GlobSetBuilder};
|
use globset::{GlobBuilder, GlobSet, GlobSetBuilder};
|
||||||
|
|
||||||
|
use std::borrow::ToOwned;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::borrow::{ToOwned};
|
|
||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
|
|
||||||
pub struct Gitignore {
|
pub struct Gitignore {
|
||||||
|
@ -5,7 +5,12 @@ use crate::pathop::PathOp;
|
|||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
pub fn spawn(cmd: &[String], updated_paths: &[PathOp], no_shell: bool, no_environment: bool) -> Result<Process> {
|
pub fn spawn(
|
||||||
|
cmd: &[String],
|
||||||
|
updated_paths: &[PathOp],
|
||||||
|
no_shell: bool,
|
||||||
|
no_environment: bool,
|
||||||
|
) -> Result<Process> {
|
||||||
self::imp::Process::new(cmd, updated_paths, no_shell, no_environment).map_err(|e| e.into())
|
self::imp::Process::new(cmd, updated_paths, no_shell, no_environment).map_err(|e| e.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +88,12 @@ mod imp {
|
|||||||
|
|
||||||
#[allow(clippy::mutex_atomic)]
|
#[allow(clippy::mutex_atomic)]
|
||||||
impl Process {
|
impl Process {
|
||||||
pub fn new(cmd: &[String], updated_paths: &[PathOp], no_shell: bool, no_environment: bool) -> Result<Self> {
|
pub fn new(
|
||||||
|
cmd: &[String],
|
||||||
|
updated_paths: &[PathOp],
|
||||||
|
no_shell: bool,
|
||||||
|
no_environment: bool,
|
||||||
|
) -> Result<Self> {
|
||||||
use nix::unistd::*;
|
use nix::unistd::*;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use std::os::unix::process::CommandExt;
|
use std::os::unix::process::CommandExt;
|
||||||
@ -234,7 +244,12 @@ mod imp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Process {
|
impl Process {
|
||||||
pub fn new(cmd: &[String], updated_paths: &[PathOp], no_shell: bool, no_environment: bool) -> Result<Self> {
|
pub fn new(
|
||||||
|
cmd: &[String],
|
||||||
|
updated_paths: &[PathOp],
|
||||||
|
no_shell: bool,
|
||||||
|
no_environment: bool,
|
||||||
|
) -> Result<Self> {
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use std::os::windows::io::IntoRawHandle;
|
use std::os::windows::io::IntoRawHandle;
|
||||||
use std::os::windows::process::CommandExt;
|
use std::os::windows::process::CommandExt;
|
||||||
|
14
src/run.rs
14
src/run.rs
@ -169,7 +169,12 @@ impl ExecHandler {
|
|||||||
|
|
||||||
debug!("Launching child process");
|
debug!("Launching child process");
|
||||||
let mut guard = self.child_process.write()?;
|
let mut guard = self.child_process.write()?;
|
||||||
*guard = Some(process::spawn(&self.args.cmd, ops, self.args.no_shell, self.args.no_environment)?);
|
*guard = Some(process::spawn(
|
||||||
|
&self.args.cmd,
|
||||||
|
ops,
|
||||||
|
self.args.no_shell,
|
||||||
|
self.args.no_environment,
|
||||||
|
)?);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -266,7 +271,12 @@ pub fn run(args: Args) -> Result<()> {
|
|||||||
watch(&ExecHandler::new(args)?)
|
watch(&ExecHandler::new(args)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wait_fs(rx: &Receiver<Event>, filter: &NotificationFilter, debounce: u64, no_meta: bool) -> Vec<PathOp> {
|
fn wait_fs(
|
||||||
|
rx: &Receiver<Event>,
|
||||||
|
filter: &NotificationFilter,
|
||||||
|
debounce: u64,
|
||||||
|
no_meta: bool,
|
||||||
|
) -> Vec<PathOp> {
|
||||||
let mut paths = Vec::new();
|
let mut paths = Vec::new();
|
||||||
let mut cache = HashMap::new();
|
let mut cache = HashMap::new();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user