Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Status: Available for use
### Added

### Fixed
- #62: Use shell_words to split the outer shell so that more complex outer shells can be used.

## [1.2.0] - 2023-07-07

Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ thiserror = "1.0.40"
tera = "1"
serde_json = "1.0.100"
toml = "0.7.6"
shell-words = "1.1.0"

[dev-dependencies]
tempfile = "3.6.0"
12 changes: 7 additions & 5 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ impl Drop for DaemonHandle {
}

impl DockerCommandBuilder {
pub fn run(&self, command: &[&str]) -> Result<(), Error> {
debug!(
"Spawning docker command with configuration: {:?} args: {:?}",
self, command
);
pub fn run<I, S>(&self, command: I) -> Result<(), Error>
where
I: IntoIterator<Item = S> + std::fmt::Debug,
S: AsRef<OsStr>,
{
debug!("Spawning docker command with configuration: {self:?}");
debug!("- and args: {command:?}");

let mut command = Command::new("docker")
.args(self.base_args())
Expand Down
7 changes: 6 additions & 1 deletion src/interpret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,13 @@ pub(crate) fn run_floki_container(
None
};

// Calculate the outer shell command.
let subshell_command = subshell_command(&spec.init, inner_command);
cmd.run(&[spec.shell.outer_shell(), "-c", &subshell_command])
let mut outer_shell_cmd = shell_words::split(spec.shell.outer_shell())?;
outer_shell_cmd.push("-c".to_string());
outer_shell_cmd.push(subshell_command);

cmd.run(outer_shell_cmd)
}

pub(crate) fn command_in_shell(shell: &str, command: &[String]) -> String {
Expand Down