Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/scripts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ use std::io::{self, prelude::*};
use std::net::IpAddr;
use std::path::PathBuf;
use std::string::ToString;
use subprocess::{Exec, ExitStatus};
use subprocess::{Exec, ExitStatus, Redirection};
use text_placeholder::Template;

static DEFAULT: &str = r#"tags = ["core_approved", "RustScan", "default"]
Expand Down Expand Up @@ -184,14 +184,14 @@ struct ExecPartsScript {
script: String,
ip: String,
port: String,
ipversion: String
ipversion: String,
}

#[derive(Serialize)]
struct ExecParts {
ip: String,
port: String,
ipversion: String
ipversion: String,
}

impl Script {
Expand Down Expand Up @@ -248,8 +248,8 @@ impl Script {
port: ports_str,
ipversion: match &self.ip {
IpAddr::V4(_) => String::from("4"),
IpAddr::V6(_) => String::from("6")
}
IpAddr::V6(_) => String::from("6"),
},
};
to_run = default_template.fill_with_struct(&exec_parts_script)?;
} else {
Expand All @@ -258,8 +258,8 @@ impl Script {
port: ports_str,
ipversion: match &self.ip {
IpAddr::V4(_) => String::from("4"),
IpAddr::V6(_) => String::from("6")
}
IpAddr::V6(_) => String::from("6"),
},
};
to_run = default_template.fill_with_struct(&exec_parts)?;
}
Expand All @@ -271,7 +271,9 @@ impl Script {
#[cfg(not(tarpaulin_include))]
fn execute_script(script: &str) -> Result<String> {
debug!("\nScript arguments {}", script);
let process = Exec::shell(script);
let process = Exec::shell(script)
.stdout(Redirection::Pipe)
.stderr(Redirection::Pipe);
match process.capture() {
Ok(c) => {
let es = match c.exit_status {
Expand Down