Hide io::errors when "waiting on process group"

This commit is contained in:
Félix Saparelli 2022-01-27 10:48:24 +13:00
parent c79d2726ba
commit 18a2b204e2
2 changed files with 13 additions and 7 deletions

View File

@ -2,17 +2,23 @@ use std::convert::Infallible;
use clap::ArgMatches;
use miette::Result;
use watchexec::{config::InitConfig, handler::SyncFnHandler};
use tracing::error;
use watchexec::{config::InitConfig, error::RuntimeError, handler::SyncFnHandler};
pub fn init(_args: &ArgMatches<'static>) -> Result<InitConfig> {
let mut config = InitConfig::default();
config.on_error(SyncFnHandler::from(
|data| -> std::result::Result<(), Infallible> {
// if let RuntimeError::IoError { .. } = data {
// // these are often spurious, so condemn them to -v only
// error!("{}", data);
// return Ok(());
// }
if let RuntimeError::IoError {
about: "waiting on process group",
..
} = data
{
// "No child processes" and such
// these are often spurious, so condemn them to -v only
error!("{}", data);
return Ok(());
}
if cfg!(debug_assertions) {
eprintln!("[[{:?}]]", data);

View File

@ -177,7 +177,7 @@ pub async fn from_origin(path: impl AsRef<Path>) -> (Vec<IgnoreFile>, Vec<Error>
/// - User-specific git ignore files (e.g. `~/.gitignore`)
/// - Git configurable ignore files (e.g. with `core.excludesFile` in system or user config)
/// - `$XDG_CONFIG_HOME/watchexec/ignore`, as well as other locations (APPDATA on Windows…)
/// - Files from the `WATCHEXEC_IGNORE_FILES` environment variable (comma-separated)
/// - Files from the `WATCHEXEC_IGNORE_FILES` environment variable (separated the same was as `PATH`)
///
/// All errors (permissions, etc) are collected and returned alongside the ignore files: you may
/// want to show them to the user while still using whatever ignores were successfully found. Errors