Add an option to always suspend vagrant boxes

This commit is contained in:
Roey Darwish Dror
2020-06-13 07:44:53 +03:00
parent 73a66e78b0
commit bb9c884f81
2 changed files with 17 additions and 4 deletions

View File

@@ -118,10 +118,14 @@ impl<'a> TemporaryPowerOn<'a> {
impl<'a> Drop for TemporaryPowerOn<'a> {
fn drop(&mut self) {
let subcommand = match self.status {
BoxStatus::PowerOff | BoxStatus::Aborted => "halt",
BoxStatus::Saved => "suspend",
BoxStatus::Running => unreachable!(),
let subcommand = if self.ctx.config().vagrant_always_suspend().unwrap_or(false) {
"suspend"
} else {
match self.status {
BoxStatus::PowerOff | BoxStatus::Aborted => "halt",
BoxStatus::Saved => "suspend",
BoxStatus::Running => unreachable!(),
}
};
println!("Powering off {}", self.vagrant_box);