mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
fish: docs: note how to clean up the remote process properly.
Killing it is always a bad idea, because the qemu subprocess will be left hanging around. The best thing is to send the exit command. This also makes the change to virt-sysprep.
This commit is contained in:
@@ -175,16 +175,16 @@ if [ -z "$GUESTFISH_PID" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Helper.
|
||||
gf="guestfish --remote --"
|
||||
|
||||
cleanup ()
|
||||
{
|
||||
kill $GUESTFISH_PID >/dev/null 2>&1 ||:
|
||||
$gf exit >/dev/null 2>&1 ||:
|
||||
rm -rf "$tmpdir" ||:
|
||||
}
|
||||
trap cleanup EXIT ERR
|
||||
|
||||
# Helper.
|
||||
gf="guestfish --remote --"
|
||||
|
||||
# Launch back-end, inspect for operating systems, and get the guest
|
||||
# root disk.
|
||||
root=$($gf inspect-get-roots)
|
||||
|
||||
@@ -996,14 +996,15 @@ and cleans up guestfish when the script exits:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
kill_guestfish ()
|
||||
cleanup_guestfish ()
|
||||
{
|
||||
kill $GUESTFISH_PID >/dev/null 2>&1 ||:
|
||||
guestfish --remote -- exit >/dev/null 2>&1 ||:
|
||||
}
|
||||
trap kill_guestfish EXIT
|
||||
trap cleanup_guestfish EXIT ERR
|
||||
|
||||
guestfish --remote run
|
||||
# etc.
|
||||
guestfish --remote -- run
|
||||
|
||||
# ...
|
||||
|
||||
=head2 REMOTE CONTROL RUN COMMAND HANGING
|
||||
|
||||
|
||||
Reference in New Issue
Block a user