mirror of
https://github.com/curl/curl.git
synced 2026-04-14 21:51:41 +03:00
testcurl.pl: replace shell commands with Perl rmtree()
Ref: https://perldoc.perl.org/5.8.2/File::Path
Follow-up to e992aa6a54
Closes #21053
This commit is contained in:
parent
e2186933c1
commit
3025c9778a
1 changed files with 3 additions and 14 deletions
|
|
@ -64,6 +64,7 @@ use strict;
|
|||
use warnings;
|
||||
|
||||
use Cwd;
|
||||
use File::Path;
|
||||
use File::Spec;
|
||||
|
||||
# Turn on warnings (equivalent to -w, which cannot be used with /usr/bin/env)
|
||||
|
|
@ -185,18 +186,6 @@ $ENV{LC_ALL}="C" if(($ENV{LC_ALL}) && ($ENV{LC_ALL} !~ /^C$/));
|
|||
$ENV{LC_CTYPE}="C" if(($ENV{LC_CTYPE}) && ($ENV{LC_CTYPE} !~ /^C$/));
|
||||
$ENV{LANG}="C";
|
||||
|
||||
sub rmtree($) {
|
||||
my $target = $_[0];
|
||||
if($^O eq 'MSWin32') {
|
||||
foreach (glob($target)) {
|
||||
s:/:\\:g;
|
||||
system('rd', ('/s', '/q', $_));
|
||||
}
|
||||
} else {
|
||||
system('rm', ('-rf', $target));
|
||||
}
|
||||
}
|
||||
|
||||
sub grepfile($$) {
|
||||
my ($target, $fn) = @_;
|
||||
open(my $fh, "<", $fn) or die;
|
||||
|
|
@ -392,8 +381,8 @@ $buildlogname="buildlog-$$";
|
|||
$buildlog="$pwd/$buildlogname";
|
||||
|
||||
# remove any previous left-overs
|
||||
rmtree "build-*";
|
||||
rmtree "buildlog-*";
|
||||
foreach(glob("build-*")) { rmtree $_; }
|
||||
foreach(glob("buildlog-*")) { rmtree $_; }
|
||||
|
||||
# this is to remove old build logs that ended up in the wrong dir
|
||||
foreach(glob("$CURLDIR/buildlog-*")) { unlink $_; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue