Ignore launch() error in virt-rescue. (RHBZ#618556)
authorMatthew Booth <mbooth@redhat.com>
Thu, 26 Aug 2010 14:08:20 +0000 (15:08 +0100)
committerRichard Jones <rjones@redhat.com>
Thu, 26 Aug 2010 14:53:25 +0000 (15:53 +0100)
launch() expects guestfsd to start, which it never does in virt-rescue, so it
always returns an error about the appliance shutting down unexpectedly.

tools/virt-rescue

index 1f292f6..51ac760 100755 (executable)
@@ -19,6 +19,7 @@
 use warnings;
 use strict;
 
+use Errno;
 use Sys::Guestfs;
 use Sys::Guestfs::Lib qw(open_guest);
 use Pod::Usage;
@@ -214,7 +215,11 @@ $g->set_append ($str);
 
 # Run the appliance.  This won't return until the user quite the
 # appliance.
-$g->launch ();
+eval { $g->launch (); };
+
+# launch() expects guestfsd to start. However, virt-rescue doesn't run guestfsd,
+# so this will always fail with ECHILD when the appliance exits unexpectedly.
+die $@ unless $!{ECHILD};
 
 exit 0;