diff --git a/Cargo.toml b/Cargo.toml index f534f2b..f9674af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "run_script" -version = "0.7.0" +version = "0.8.0" authors = ["Sagie Gur-Ari "] description = "Run shell scripts in rust." license = "Apache-2.0" @@ -28,7 +28,6 @@ fsio = { version = "^0.2", features = ["temp-path"] } [dev-dependencies] doc-comment = "^0.3" -rusty-hook = "^0.11" [badges.codecov] branch = "master" diff --git a/README.md b/README.md index 4e661d7..8872668 100755 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ In order to use this library, just add it as a dependency: ```ini [dependencies] -run_script = "^0.7.0" +run_script = "^0.8.0" ``` ## API Documentation diff --git a/docs/api/run_script/all.html b/docs/api/run_script/all.html index 6454901..5554a05 100644 --- a/docs/api/run_script/all.html +++ b/docs/api/run_script/all.html @@ -1,6 +1,6 @@ List of all items in this crate -

[][src]Module run_script::types

types

Defines the various types and aliases.

Structs

ScriptOptions

Options available for invoking the script

diff --git a/docs/api/run_script/types/struct.ScriptOptions.html b/docs/api/run_script/types/struct.ScriptOptions.html index cb75c07..6371179 100644 --- a/docs/api/run_script/types/struct.ScriptOptions.html +++ b/docs/api/run_script/types/struct.ScriptOptions.html @@ -1,13 +1,14 @@ run_script::types::ScriptOptions - Rust -

[][src]Struct run_script::types::ScriptOptions

pub struct ScriptOptions {
+

[][src]Struct run_script::types::ScriptOptions

pub struct ScriptOptions {
     pub runner: Option<String>,
     pub working_directory: Option<PathBuf>,
     pub input_redirection: IoOptions,
     pub output_redirection: IoOptions,
     pub exit_on_error: bool,
     pub print_commands: bool,
+    pub env_vars: Option<HashMap<String, String>>,
 }

Options available for invoking the script

Fields

runner: Option<String>

Defines the requested runner (defaults to cmd in windows and sh for other platforms)

@@ -16,7 +17,8 @@
output_redirection: IoOptions

Default is IoOptions::Pipe (only pipe enables to capture the output)

exit_on_error: bool

Sets -e flag. Will exit on any error while running the script (not available for windows)

print_commands: bool

Sets -x flag for printing each script command before invocation (not available for windows)

-

Implementations

impl ScriptOptions[src]

pub fn new() -> ScriptOptions[src]

Returns new instance

+
env_vars: Option<HashMap<String, String>>

Environment environment variables to add before invocation

+

Implementations

impl ScriptOptions[src]

pub fn new() -> ScriptOptions[src]

Returns new instance

Trait Implementations

impl Clone for ScriptOptions[src]

impl Debug for ScriptOptions[src]

 //! # command
 //!
@@ -315,6 +319,10 @@
 ) -> Command {
     let mut command = Command::new(&command_string);
 
+    if options.env_vars.is_some() {
+        command.envs(options.env_vars.as_ref().unwrap());
+    }
+
     for arg in args.iter() {
         command.arg(arg);
     }
diff --git a/docs/api/src/run_script/types.rs.html b/docs/api/src/run_script/types.rs.html
index 211934f..e226cf9 100644
--- a/docs/api/src/run_script/types.rs.html
+++ b/docs/api/src/run_script/types.rs.html
@@ -93,6 +93,9 @@
 90
 91
 92
+93
+94
+95
 
 //! # types
 //!
@@ -160,6 +163,8 @@
     pub exit_on_error: bool,
     /// Sets -x flag for printing each script command before invocation (not available for windows)
     pub print_commands: bool,
+    /// Environment environment variables to add before invocation
+    pub env_vars: Option<std::collections::HashMap<String, String>>,
 }
 
 #[derive(Debug, Copy, Clone, PartialEq)]
@@ -183,6 +188,7 @@
             output_redirection: IoOptions::Pipe,
             exit_on_error: false,
             print_commands: false,
+            env_vars: None,
         }
     }
 }
diff --git a/src/lib_test.rs b/src/lib_test.rs
index 6570bf4..278ac14 100644
--- a/src/lib_test.rs
+++ b/src/lib_test.rs
@@ -1,6 +1,5 @@
 use super::*;
 use doc_comment as _;
-use rusty_hook as _;
 
 #[test]
 fn run_test() {