mirror of
https://github.com/watchexec/watchexec.git
synced 2024-11-14 08:11:11 +01:00
Expose shell via builder
This commit is contained in:
parent
1280a15ca2
commit
92060e5655
3 changed files with 18 additions and 0 deletions
|
@ -15,6 +15,8 @@
|
|||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::process::Shell;
|
||||
|
||||
/// Arguments to the watcher
|
||||
#[derive(Builder, Clone, Debug)]
|
||||
#[builder(setter(into, strip_option))]
|
||||
|
@ -46,6 +48,9 @@ pub struct Config {
|
|||
/// Run the commands right after starting.
|
||||
#[builder(default = "true")]
|
||||
pub run_initially: bool,
|
||||
/// Specify the shell to use.
|
||||
#[builder(default)]
|
||||
pub shell: Shell,
|
||||
/// Do not wrap the commands in a shell.
|
||||
#[builder(default)]
|
||||
pub no_shell: bool,
|
||||
|
|
|
@ -34,6 +34,7 @@ pub mod run;
|
|||
mod signal;
|
||||
mod watcher;
|
||||
|
||||
pub use process::Shell;
|
||||
pub use run::{run, watch, Handler};
|
||||
|
||||
#[deprecated(since = "1.15.0", note = "Config has moved to config::Config")]
|
||||
|
|
|
@ -19,6 +19,18 @@ pub enum Shell {
|
|||
Powershell,
|
||||
}
|
||||
|
||||
impl Default for Shell {
|
||||
#[cfg(windows)]
|
||||
fn default() -> Self {
|
||||
Self::Powershell
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
fn default() -> Self {
|
||||
Self::Unix("sh".into())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn spawn(
|
||||
cmd: &[String],
|
||||
updated_paths: &[PathOp],
|
||||
|
|
Loading…
Reference in a new issue