From b378c128d1a2c1f4592eb7cb215ebacd05647d67 Mon Sep 17 00:00:00 2001 From: GeorgeClark Date: Tue, 13 Jul 2010 12:30:16 +0000 Subject: [PATCH] Item9312: Don't die on cwd change git-svn-id: http://svn.foswiki.org/trunk@8160 0b4bb1d4-4e5a-0410-9cc4-b2b747904278 --- UnitTestContrib/lib/Unit/TestRunner.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/UnitTestContrib/lib/Unit/TestRunner.pm b/UnitTestContrib/lib/Unit/TestRunner.pm index 72d93718db..5d908a390d 100644 --- a/UnitTestContrib/lib/Unit/TestRunner.pm +++ b/UnitTestContrib/lib/Unit/TestRunner.pm @@ -39,7 +39,7 @@ sub start { @{ $this->{initialINC} } = @INC; my $passes = 0; - my $start_cwd = Cwd->cwd(); + my ($start_cwd) = Cwd->cwd() =~ m/^(.*)$/; print "Starting CWD is $start_cwd \n"; # First use all the tests to get them compiled @@ -130,7 +130,11 @@ sub start { $action = runOne( $tester, $suite, $testToRun ); } - die "CWD changed to " . Cwd->cwd() . " by previous test!! \n" if ( Cwd->cwd() ne $start_cwd) ; + if ( Cwd->cwd() ne $start_cwd) { + print "CWD changed to " . Cwd->cwd() + . " by previous test!! \n"; + chdir $start_cwd or die "Cannot change back to previous $start_cwd\n"; + } # untaint action for the case where the test is run in # another process