From c09fcb72e962477cf32f790c502ee2fb4419aa0e Mon Sep 17 00:00:00 2001 From: steve Date: Sat, 10 Jun 2006 17:36:09 +0000 Subject: [PATCH] 2006-06-10 17:36:09 by steve When a command fails show its output when running with --verbose *before* exiting --- bin/xen-create-image | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/bin/xen-create-image b/bin/xen-create-image index a39bb26..43ddac3 100755 --- a/bin/xen-create-image +++ b/bin/xen-create-image @@ -394,7 +394,7 @@ Install an X11 server, using VNC and XDM -- http://www.steve.org.uk/ - $Id: xen-create-image,v 1.22 2006-06-10 17:28:41 steve Exp $ + $Id: xen-create-image,v 1.23 2006-06-10 17:36:09 steve Exp $ =cut @@ -759,7 +759,7 @@ sub parseCommandLineArguments "cache=s", \$CONFIG{'cache'}, "ide", \$CONFIG{'ide'}, "passwd", \$CONFIG{'passwd'}, - "role", \$CONFIG{'role'}, + "role=s", \$CONFIG{'role'}, "force", \$CONFIG{'force'}, # Help options @@ -776,7 +776,7 @@ sub parseCommandLineArguments if ( $VERSION ) { - my $REVISION = '$Revision: 1.22 $'; + my $REVISION = '$Revision: 1.23 $'; if ( $REVISION =~ /1.([0-9.]+) / ) { @@ -1304,7 +1304,8 @@ sub runCustomisationHooks # if ( $CONFIG{'verbose'} ) { - print "=============\n"; + print "Customization Script Environment:\n"; + print "---------------------------------\n"; foreach my $key ( sort keys %ENV ) { print "\t'" . $key . "' = '" . $ENV{$key} . "'\n"; @@ -1426,14 +1427,6 @@ sub runCommand # my $output = `$cmd`; - if ( $? != 0 ) - { - print "Running command '$cmd' failed.\n"; - print "Aborting\n"; - exit; - } - - # # All done. # @@ -1442,6 +1435,15 @@ sub runCommand $CONFIG{'verbose'} && print $output . "\n"; $CONFIG{'verbose'} && print "Finished : $cmd\n"; + + if ( $? != 0 ) + { + print "Running command '$cmd' failed.\n"; + print "Aborting\n"; + exit; + } + + return( $output ); }