mirror of
https://github.com/watchexec/watchexec.git
synced 2024-09-29 22:51:33 +02:00
Expose shell via builder
This commit is contained in:
parent
1280a15ca2
commit
92060e5655
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
use crate::process::Shell;
|
||||||
|
|
||||||
/// Arguments to the watcher
|
/// Arguments to the watcher
|
||||||
#[derive(Builder, Clone, Debug)]
|
#[derive(Builder, Clone, Debug)]
|
||||||
#[builder(setter(into, strip_option))]
|
#[builder(setter(into, strip_option))]
|
||||||
@ -46,6 +48,9 @@ pub struct Config {
|
|||||||
/// Run the commands right after starting.
|
/// Run the commands right after starting.
|
||||||
#[builder(default = "true")]
|
#[builder(default = "true")]
|
||||||
pub run_initially: bool,
|
pub run_initially: bool,
|
||||||
|
/// Specify the shell to use.
|
||||||
|
#[builder(default)]
|
||||||
|
pub shell: Shell,
|
||||||
/// Do not wrap the commands in a shell.
|
/// Do not wrap the commands in a shell.
|
||||||
#[builder(default)]
|
#[builder(default)]
|
||||||
pub no_shell: bool,
|
pub no_shell: bool,
|
||||||
|
@ -34,6 +34,7 @@ pub mod run;
|
|||||||
mod signal;
|
mod signal;
|
||||||
mod watcher;
|
mod watcher;
|
||||||
|
|
||||||
|
pub use process::Shell;
|
||||||
pub use run::{run, watch, Handler};
|
pub use run::{run, watch, Handler};
|
||||||
|
|
||||||
#[deprecated(since = "1.15.0", note = "Config has moved to config::Config")]
|
#[deprecated(since = "1.15.0", note = "Config has moved to config::Config")]
|
||||||
|
@ -19,6 +19,18 @@ pub enum Shell {
|
|||||||
Powershell,
|
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(
|
pub fn spawn(
|
||||||
cmd: &[String],
|
cmd: &[String],
|
||||||
updated_paths: &[PathOp],
|
updated_paths: &[PathOp],
|
||||||
|
Loading…
Reference in New Issue
Block a user