Process --no-process-group

This commit is contained in:
Félix Saparelli 2021-12-24 03:47:15 +13:00
parent ec49185488
commit bb212b413f
No known key found for this signature in database
GPG Key ID: B948C4BAE44FC474
5 changed files with 15 additions and 8 deletions

View File

@ -163,7 +163,7 @@ pub fn get_args() -> Result<ArgMatches<'static>> {
.help_heading(Some(OPTSET_OUTPUT))
.help("Do not set WATCHEXEC_*_PATH environment variables for the command")
.long("no-environment"))
.arg(Arg::with_name("no-process-group") // TODO
.arg(Arg::with_name("no-process-group")
.help_heading(Some(OPTSET_COMMAND))
.help("Do not use a process group when running the command")
.long("no-process-group"))

View File

@ -38,6 +38,10 @@ pub fn runtime(args: &ArgMatches<'static>) -> Result<RuntimeConfig> {
)));
}
if args.is_present("no-process-group") {
config.command_grouped(false);
}
config.command_shell(if args.is_present("no-shell") {
Shell::None
} else if let Some(s) = args.value_of("shell") {
@ -174,6 +178,8 @@ pub fn runtime(args: &ArgMatches<'static>) -> Result<RuntimeConfig> {
fut
});
// TODO: pre-command (environment vars)
Ok(config)
}

View File

@ -2,7 +2,6 @@ use std::{
collections::HashSet,
env,
path::{Path, PathBuf},
sync::Arc,
};
use clap::ArgMatches;
@ -10,7 +9,6 @@ use dunce::canonicalize;
use miette::{IntoDiagnostic, Result};
use tracing::{debug, warn};
use watchexec::{
filter::tagged::{Filter, Matcher, Op, Pattern, Regex, TaggedFilterer},
ignore_files::{self, IgnoreFile},
paths::common_prefix,
project::{self, ProjectType},
@ -36,7 +34,7 @@ pub async fn dirs(args: &ArgMatches<'static>) -> Result<(PathBuf, PathBuf)> {
Ok((project_origin, workdir))
}
pub async fn ignores(args: &ArgMatches<'static>, origin: &Path) -> Result<Vec<IgnoreFile>> {
pub async fn ignores(_args: &ArgMatches<'static>, origin: &Path) -> Result<Vec<IgnoreFile>> {
let vcs_types = project::types(origin)
.await
.into_iter()
@ -105,5 +103,8 @@ pub async fn ignores(args: &ArgMatches<'static>, origin: &Path) -> Result<Vec<Ig
debug!(?ignores, "combined and applied final filter over ignores");
}
// TODO: --no-ignore
// TODO: --no-vcs-ignore
Ok(ignores)
}

View File

@ -5,8 +5,8 @@ use miette::{IntoDiagnostic, Result};
use watchexec::filter::globset::GlobsetFilterer;
pub async fn globset(args: &ArgMatches<'static>) -> Result<Arc<GlobsetFilterer>> {
let (project_origin, workdir) = super::common::dirs(args).await?;
let ignores = super::common::ignores(args, &project_origin).await?;
let (project_origin, _workdir) = super::common::dirs(args).await?;
let _ignores = super::common::ignores(args, &project_origin).await?;
// TODO: load ignorefiles
let filters = args

View File

@ -1,9 +1,9 @@
use std::sync::Arc;
use clap::ArgMatches;
use miette::{IntoDiagnostic, Result};
use miette::Result;
use tracing::debug;
use watchexec::filter::tagged::{Filter, Matcher, Op, Pattern, Regex, TaggedFilterer};
use watchexec::filter::tagged::{Filter, TaggedFilterer};
pub async fn tagged(args: &ArgMatches<'static>) -> Result<Arc<TaggedFilterer>> {
let (project_origin, workdir) = super::common::dirs(args).await?;