diff --git a/xCAT-server/lib/xcat/plugins/copycds.pm b/xCAT-server/lib/xcat/plugins/copycds.pm index d16af1724..06894e3a6 100644 --- a/xCAT-server/lib/xcat/plugins/copycds.pm +++ b/xCAT-server/lib/xcat/plugins/copycds.pm @@ -5,6 +5,7 @@ use xCAT::Table; use Data::Dumper; use Getopt::Long; use File::Basename; +use Cwd; Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); @@ -34,6 +35,7 @@ sub process_request { my $arch = undef; $identified=0; $::CDMOUNTPATH="/mnt/xcat"; + my $existdir = getcwd; @ARGV = @{$request->{arg}}; GetOptions( @@ -94,6 +96,8 @@ sub process_request { $doreq->($newreq,\&take_answer); $::CDMOUNTPATH=""; + chdir($existdir); + while (wait() > 0) { yield; } #Make sure all children exit before trying umount system("umount /mnt/xcat"); unless ($identified) { $callback->({error=>["copycds could not identify the ISO supplied, you may wish to try -n "],errorcode=>[1]});