Remove/deprecate Config.no_shell
This commit is contained in:
parent
4c29c7a09d
commit
e5cdd51633
|
@ -5,7 +5,7 @@ use std::{
|
|||
path::{PathBuf, MAIN_SEPARATOR},
|
||||
};
|
||||
|
||||
use crate::error;
|
||||
use crate::{error, Shell};
|
||||
use crate::config::{Config, ConfigBuilder};
|
||||
|
||||
pub fn get_args() -> error::Result<(Config, LevelFilter)> {
|
||||
|
@ -119,7 +119,7 @@ where
|
|||
.long("shell"))
|
||||
// -n short form will not be removed, and instead become a shorthand for --shell=none
|
||||
.arg(Arg::with_name("no-shell")
|
||||
.help("Do not wrap command in 'sh -c' resp. 'cmd.exe /C'")
|
||||
.help("Do not wrap command in a shell. Deprecated: use --shell=none instead.")
|
||||
.short("n")
|
||||
.long("no-shell"))
|
||||
.arg(Arg::with_name("no-meta")
|
||||
|
@ -227,7 +227,6 @@ where
|
|||
builder.clear_screen(args.is_present("clear"));
|
||||
builder.restart(args.is_present("restart"));
|
||||
builder.run_initially(!args.is_present("postpone"));
|
||||
builder.no_shell(args.is_present("no-shell"));
|
||||
builder.no_meta(args.is_present("no-meta"));
|
||||
builder.no_environment(args.is_present("no-environment"));
|
||||
builder.no_vcs_ignore(args.is_present("no-vcs-ignore"));
|
||||
|
|
|
@ -51,9 +51,6 @@ pub struct Config {
|
|||
/// Specify the shell to use.
|
||||
#[builder(default)]
|
||||
pub shell: Shell,
|
||||
/// Do not wrap the commands in a shell.
|
||||
#[builder(default)]
|
||||
pub no_shell: bool,
|
||||
/// Ignore metadata changes.
|
||||
#[builder(default)]
|
||||
pub no_meta: bool,
|
||||
|
@ -98,4 +95,14 @@ impl ConfigBuilder {
|
|||
pub fn debug(&mut self, _: impl Into<bool>) -> &mut Self {
|
||||
self
|
||||
}
|
||||
|
||||
/// Do not wrap the commands in a shell.
|
||||
#[deprecated(since = "1.15.0", note = "use shell(Shell::None) instead")]
|
||||
pub fn no_shell(&mut self, s: impl Into<bool>) -> &mut Self {
|
||||
if s.into() {
|
||||
self.shell(Shell::default())
|
||||
} else {
|
||||
self.shell(Shell::None)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
22
src/run.rs
22
src/run.rs
|
@ -5,7 +5,7 @@ use crate::gitignore;
|
|||
use crate::ignore;
|
||||
use crate::notification_filter::NotificationFilter;
|
||||
use crate::pathop::PathOp;
|
||||
use crate::process::{self, Shell, Process};
|
||||
use crate::process::{self, Process};
|
||||
use crate::signal::{self, Signal};
|
||||
use crate::watcher::{Event, Watcher};
|
||||
use std::{
|
||||
|
@ -168,30 +168,12 @@ impl ExecHandler {
|
|||
clear_screen();
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
fn get_shell(config: &Config) -> Shell {
|
||||
if config.no_shell {
|
||||
Shell::None
|
||||
} else {
|
||||
Shell::Cmd
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
fn get_shell(config: &Config) -> Shell {
|
||||
if config.no_shell {
|
||||
Shell::None
|
||||
} else {
|
||||
Shell::Unix("sh".into())
|
||||
}
|
||||
}
|
||||
|
||||
debug!("Launching child process");
|
||||
let mut guard = self.child_process.write()?;
|
||||
*guard = Some(process::spawn(
|
||||
&self.args.cmd,
|
||||
ops,
|
||||
get_shell(&self.args),
|
||||
self.args.shell.clone(),
|
||||
!self.args.no_environment,
|
||||
)?);
|
||||
|
||||
|
|
Loading…
Reference in New Issue