diff --git a/README.md b/README.md index 0d3bf6c..c8629bc 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ signal: (INT) signal to send path: (B64_STR) Path of the executable -args: (B64_STR) Arguments to run the executable with +args: (B64_STR) Arguments to run the executable with. Arguments are seperated with \0 env: (B64_STR) Environment variables to pass to the executable in the following format: `VAR1=VAL1;VAR2=VAL2;`. Take care to escape `\;`, `\=` and `\\` properly. diff --git a/src/process.rs b/src/process.rs index 3617be0..042f776 100644 --- a/src/process.rs +++ b/src/process.rs @@ -32,11 +32,12 @@ pub fn process( Err(e) => return Err(format!("Error decoding exec path: {}", e)), }; - let args = match decode(b_args) { + let raw_args = match decode(b_args) { Ok(dec_vec) if dec_vec.is_empty() => String::new(), Ok(dec_vec) => String::from_utf8(dec_vec).expect("Invalid UTF8 for exec args"), Err(e) => return Err(format!("Error decoding exec args: {}", e)), }; + let args = raw_args.split('\0').collect::>(); let raw_env_vars = match decode(b_env_vars) { Ok(dec_vec) if dec_vec.is_empty() => String::new(), @@ -95,7 +96,7 @@ pub fn process( let poll_data = poll_data_main.clone(); let mut proc = match Exec::cmd(process) - .arg(args) + .args(args.as_slice()) .env_extend(&env_vars) .stdout(Redirection::Pipe) .stderr(Redirection::Pipe)