mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-09 13:26:48 +00:00
Add safety check to stop_guest
function to prevent killing non-existent processes
This commit is contained in:
parent
56068d8e9e
commit
dec7ac1346
@ -7,7 +7,8 @@ set -e
|
|||||||
# Function to stop the guest VM
|
# Function to stop the guest VM
|
||||||
stop_guest() {
|
stop_guest() {
|
||||||
echo "Stopping guest VM..."
|
echo "Stopping guest VM..."
|
||||||
pgrep qemu | xargs kill
|
# `-r` means if there's no qemu, the kill won't be executed
|
||||||
|
pgrep qemu | xargs -r kill
|
||||||
}
|
}
|
||||||
|
|
||||||
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
||||||
|
@ -7,7 +7,8 @@ set -e
|
|||||||
# Function to stop the guest VM
|
# Function to stop the guest VM
|
||||||
stop_guest() {
|
stop_guest() {
|
||||||
echo "Stopping guest VM..."
|
echo "Stopping guest VM..."
|
||||||
pgrep qemu | xargs kill
|
# `-r` means if there's no qemu, the kill won't be executed
|
||||||
|
pgrep qemu | xargs -r kill
|
||||||
}
|
}
|
||||||
|
|
||||||
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
||||||
|
@ -7,7 +7,8 @@ set -e
|
|||||||
# Function to stop the guest VM
|
# Function to stop the guest VM
|
||||||
stop_guest() {
|
stop_guest() {
|
||||||
echo "Stopping guest VM..."
|
echo "Stopping guest VM..."
|
||||||
pgrep qemu | xargs kill
|
# `-r` means if there's no qemu, the kill won't be executed
|
||||||
|
pgrep qemu | xargs -r kill
|
||||||
}
|
}
|
||||||
|
|
||||||
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
||||||
|
@ -7,7 +7,8 @@ set -e
|
|||||||
# Function to stop the guest VM
|
# Function to stop the guest VM
|
||||||
stop_guest() {
|
stop_guest() {
|
||||||
echo "Stopping guest VM..."
|
echo "Stopping guest VM..."
|
||||||
pgrep qemu | xargs kill
|
# `-r` means if there's no qemu, the kill won't be executed
|
||||||
|
pgrep qemu | xargs -r kill
|
||||||
}
|
}
|
||||||
|
|
||||||
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
||||||
|
@ -7,7 +7,8 @@ set -e
|
|||||||
# Function to stop the guest VM
|
# Function to stop the guest VM
|
||||||
stop_guest() {
|
stop_guest() {
|
||||||
echo "Stopping guest VM..."
|
echo "Stopping guest VM..."
|
||||||
pgrep qemu | xargs kill
|
# `-r` means if there's no qemu, the kill won't be executed
|
||||||
|
pgrep qemu | xargs -r kill
|
||||||
}
|
}
|
||||||
|
|
||||||
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
||||||
|
@ -7,7 +7,8 @@ set -e
|
|||||||
# Function to stop the guest VM
|
# Function to stop the guest VM
|
||||||
stop_guest() {
|
stop_guest() {
|
||||||
echo "Stopping guest VM..."
|
echo "Stopping guest VM..."
|
||||||
pgrep qemu | xargs kill
|
# `-r` means if there's no qemu, the kill won't be executed
|
||||||
|
pgrep qemu | xargs -r kill
|
||||||
}
|
}
|
||||||
|
|
||||||
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
||||||
|
@ -7,7 +7,8 @@ set -e
|
|||||||
# Function to stop the guest VM
|
# Function to stop the guest VM
|
||||||
stop_guest() {
|
stop_guest() {
|
||||||
echo "Stopping guest VM..."
|
echo "Stopping guest VM..."
|
||||||
pgrep qemu | xargs kill
|
# `-r` means if there's no qemu, the kill won't be executed
|
||||||
|
pgrep qemu | xargs -r kill
|
||||||
}
|
}
|
||||||
|
|
||||||
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
||||||
|
@ -7,7 +7,8 @@ set -e
|
|||||||
# Function to stop the guest VM
|
# Function to stop the guest VM
|
||||||
stop_guest() {
|
stop_guest() {
|
||||||
echo "Stopping guest VM..."
|
echo "Stopping guest VM..."
|
||||||
pgrep qemu | xargs kill
|
# `-r` means if there's no qemu, the kill won't be executed
|
||||||
|
pgrep qemu | xargs -r kill
|
||||||
}
|
}
|
||||||
|
|
||||||
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
||||||
|
@ -7,7 +7,8 @@ set -e
|
|||||||
# Function to stop the guest VM
|
# Function to stop the guest VM
|
||||||
stop_guest() {
|
stop_guest() {
|
||||||
echo "Stopping guest VM..."
|
echo "Stopping guest VM..."
|
||||||
pgrep qemu | xargs kill
|
# `-r` means if there's no qemu, the kill won't be executed
|
||||||
|
pgrep qemu | xargs -r kill
|
||||||
}
|
}
|
||||||
|
|
||||||
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
||||||
|
@ -7,7 +7,8 @@ set -e
|
|||||||
# Function to stop the guest VM
|
# Function to stop the guest VM
|
||||||
stop_guest() {
|
stop_guest() {
|
||||||
echo "Stopping guest VM..."
|
echo "Stopping guest VM..."
|
||||||
pgrep qemu | xargs kill
|
# `-r` means if there's no qemu, the kill won't be executed
|
||||||
|
pgrep qemu | xargs -r kill
|
||||||
}
|
}
|
||||||
|
|
||||||
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
||||||
|
@ -7,7 +7,8 @@ set -e
|
|||||||
# Function to stop the guest VM
|
# Function to stop the guest VM
|
||||||
stop_guest() {
|
stop_guest() {
|
||||||
echo "Stopping guest VM..."
|
echo "Stopping guest VM..."
|
||||||
pgrep qemu | xargs kill
|
# `-r` means if there's no qemu, the kill won't be executed
|
||||||
|
pgrep qemu | xargs -r kill
|
||||||
}
|
}
|
||||||
|
|
||||||
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
||||||
|
@ -7,7 +7,8 @@ set -e
|
|||||||
# Function to stop the guest VM
|
# Function to stop the guest VM
|
||||||
stop_guest() {
|
stop_guest() {
|
||||||
echo "Stopping guest VM..."
|
echo "Stopping guest VM..."
|
||||||
pgrep qemu | xargs kill
|
# `-r` means if there's no qemu, the kill won't be executed
|
||||||
|
pgrep qemu | xargs -r kill
|
||||||
}
|
}
|
||||||
|
|
||||||
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
||||||
|
@ -7,7 +7,8 @@ set -e
|
|||||||
# Function to stop the guest VM
|
# Function to stop the guest VM
|
||||||
stop_guest() {
|
stop_guest() {
|
||||||
echo "Stopping guest VM..."
|
echo "Stopping guest VM..."
|
||||||
pgrep qemu | xargs kill
|
# `-r` means if there's no qemu, the kill won't be executed
|
||||||
|
pgrep qemu | xargs -r kill
|
||||||
}
|
}
|
||||||
|
|
||||||
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
||||||
|
@ -7,7 +7,8 @@ set -e
|
|||||||
# Function to stop the guest VM
|
# Function to stop the guest VM
|
||||||
stop_guest() {
|
stop_guest() {
|
||||||
echo "Stopping guest VM..."
|
echo "Stopping guest VM..."
|
||||||
pgrep qemu | xargs kill
|
# `-r` means if there's no qemu, the kill won't be executed
|
||||||
|
pgrep qemu | xargs -r kill
|
||||||
}
|
}
|
||||||
|
|
||||||
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
||||||
|
@ -7,7 +7,8 @@ set -e
|
|||||||
# Function to stop the guest VM
|
# Function to stop the guest VM
|
||||||
stop_guest() {
|
stop_guest() {
|
||||||
echo "Stopping guest VM..."
|
echo "Stopping guest VM..."
|
||||||
pgrep qemu | xargs kill
|
# `-r` means if there's no qemu, the kill won't be executed
|
||||||
|
pgrep qemu | xargs -r kill
|
||||||
}
|
}
|
||||||
|
|
||||||
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
# Trap EXIT signal to ensure guest VM is stopped on script exit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user