fish: docs: note how to clean up the remote process properly.
[libguestfs.git] / clone / virt-sysprep.in
index b6c8a40..792282c 100644 (file)
@@ -175,16 +175,16 @@ if [ -z "$GUESTFISH_PID" ]; then
     exit 1
 fi
 
     exit 1
 fi
 
+# Helper.
+gf="guestfish --remote --"
+
 cleanup ()
 {
 cleanup ()
 {
-    kill $GUESTFISH_PID >/dev/null 2>&1 ||:
+    $gf exit >/dev/null 2>&1 ||:
     rm -rf "$tmpdir" ||:
 }
 trap cleanup EXIT ERR
 
     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)
 # Launch back-end, inspect for operating systems, and get the guest
 # root disk.
 root=$($gf inspect-get-roots)