Skip to content
Open
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
10 changes: 9 additions & 1 deletion src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ pub struct Command<'w, 'pl> {
no_output_timeout: Option<Duration>,
log_command: bool,
log_output: bool,
cargo_home_mount_kind: MountKind,
}

impl<'w, 'pl> Command<'w, 'pl> {
Expand Down Expand Up @@ -261,9 +262,16 @@ impl<'w, 'pl> Command<'w, 'pl> {
no_output_timeout,
log_output: true,
log_command: true,
cargo_home_mount_kind: MountKind::ReadOnly,
}
}

/// Mount the cargo home directory as read-write in the sandbox.
pub fn rw_cargo_home(mut self) -> Self {
self.cargo_home_mount_kind = MountKind::ReadWrite;
self
}

/// Add command-line arguments to the command. This method can be called multiple times to add
/// additional args.
pub fn args<S: AsRef<OsStr>>(mut self, args: &[S]) -> Self {
Expand Down Expand Up @@ -413,7 +421,7 @@ impl<'w, 'pl> Command<'w, 'pl> {
.mount(
&workspace.cargo_home(),
&container_dirs::CARGO_HOME,
MountKind::ReadOnly,
self.cargo_home_mount_kind,
)
.mount(
&workspace.rustup_home(),
Expand Down