aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/scripts/azure-pipelines/osx/stop-delete-all-vms.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/scripts/azure-pipelines/osx/stop-delete-all-vms.zsh')
-rw-r--r--vcpkg/scripts/azure-pipelines/osx/stop-delete-all-vms.zsh17
1 files changed, 17 insertions, 0 deletions
diff --git a/vcpkg/scripts/azure-pipelines/osx/stop-delete-all-vms.zsh b/vcpkg/scripts/azure-pipelines/osx/stop-delete-all-vms.zsh
new file mode 100644
index 0000000..1eb6fef
--- /dev/null
+++ b/vcpkg/scripts/azure-pipelines/osx/stop-delete-all-vms.zsh
@@ -0,0 +1,17 @@
+#!/usr/bin/env zsh
+
+vm_name=$(/usr/local/bin/prlctl list --all --output name --no-header 2>/dev/null | head -1)
+if [[ -z "$vm_name" ]]; then
+ echo "No VM found on the system."
+ exit 0
+fi
+
+echo "Found VM: $vm_name"
+
+# Stop the VM if it's running
+echo "Stopping VM..."
+/usr/local/bin/prlctl stop "$vm_name" --kill 2>/dev/null || echo "VM was already stopped or failed to stop"
+
+# Delete the VM
+echo "Deleting VM..."
+/usr/local/bin/prlctl delete "$vm_name" \ No newline at end of file