Skip to content
Snippets Groups Projects
Commit 2ae85664 authored by Sylvestre Ledru's avatar Sylvestre Ledru
Browse files

Replace system() by native perl calls

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209524 91177308-0d34-0410-b5e6-96231b3b80d8
parent 7ed2a980
No related branches found
No related tags found
No related merge requests found
...@@ -71,10 +71,10 @@ my $ResultFile; ...@@ -71,10 +71,10 @@ my $ResultFile;
# Remove any stale files at exit. # Remove any stale files at exit.
END { END {
if (defined $ResultFile && -z $ResultFile) { if (defined $ResultFile && -z $ResultFile) {
`rm -f $ResultFile`; unlink($ResultFile);
} }
if (defined $CleanupFile) { if (defined $CleanupFile) {
`rm -f $CleanupFile`; unlink($CleanupFile);
} }
} }
...@@ -127,7 +127,7 @@ sub ProcessClangFailure { ...@@ -127,7 +127,7 @@ sub ProcessClangFailure {
close OUT; close OUT;
`uname -a >> $PPFile.info.txt 2>&1`; `uname -a >> $PPFile.info.txt 2>&1`;
`$Compiler -v >> $PPFile.info.txt 2>&1`; `$Compiler -v >> $PPFile.info.txt 2>&1`;
system 'mv',$ofile,"$PPFile.stderr.txt"; rename($ofile, "$PPFile.stderr.txt");
return (basename $PPFile); return (basename $PPFile);
} }
......
...@@ -18,6 +18,8 @@ use FindBin qw($RealBin); ...@@ -18,6 +18,8 @@ use FindBin qw($RealBin);
use Digest::MD5; use Digest::MD5;
use File::Basename; use File::Basename;
use File::Find; use File::Find;
use File::Copy qw(copy);
use File::Path qw( rmtree mkpath );
use Term::ANSIColor; use Term::ANSIColor;
use Term::ANSIColor qw(:constants); use Term::ANSIColor qw(:constants);
use Cwd qw/ getcwd abs_path /; use Cwd qw/ getcwd abs_path /;
...@@ -204,7 +206,7 @@ sub GetHTMLRunDir { ...@@ -204,7 +206,7 @@ sub GetHTMLRunDir {
else { else {
$NewDir = "$Dir/$DateString-$RunNumber"; $NewDir = "$Dir/$DateString-$RunNumber";
} }
system 'mkdir','-p',$NewDir; mkpath($NewDir);
return $NewDir; return $NewDir;
} }
...@@ -293,7 +295,7 @@ sub UpdateInFilePath { ...@@ -293,7 +295,7 @@ sub UpdateInFilePath {
close (ROUT); close (ROUT);
close (RIN); close (RIN);
system("mv", "$fname.tmp", $fname); rename("$fname.tmp", $fname)
} }
##----------------------------------------------------------------------------## ##----------------------------------------------------------------------------##
...@@ -352,14 +354,14 @@ sub ScanFile { ...@@ -352,14 +354,14 @@ sub ScanFile {
if (defined $AlreadyScanned{$digest}) { if (defined $AlreadyScanned{$digest}) {
# Redundant file. Remove it. # Redundant file. Remove it.
system ("rm", "-f", "$Dir/$FName"); unlink("$Dir/$FName");
return; return;
} }
$AlreadyScanned{$digest} = 1; $AlreadyScanned{$digest} = 1;
# At this point the report file is not world readable. Make it happen. # At this point the report file is not world readable. Make it happen.
system ("chmod", "644", "$Dir/$FName"); chmod(0644, "$Dir/$FName");
# Scan the report file for tags. # Scan the report file for tags.
open(IN, "$Dir/$FName") or DieDiag("Cannot open '$Dir/$FName'\n"); open(IN, "$Dir/$FName") or DieDiag("Cannot open '$Dir/$FName'\n");
...@@ -424,7 +426,7 @@ sub CopyFiles { ...@@ -424,7 +426,7 @@ sub CopyFiles {
DieDiag("Cannot find 'sorttable.js'.\n") DieDiag("Cannot find 'sorttable.js'.\n")
if (! -r $JS); if (! -r $JS);
system ("cp", $JS, "$Dir"); copy($JS, "$Dir");
DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n") DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n")
if (! -r "$Dir/sorttable.js"); if (! -r "$Dir/sorttable.js");
...@@ -434,7 +436,7 @@ sub CopyFiles { ...@@ -434,7 +436,7 @@ sub CopyFiles {
DieDiag("Cannot find 'scanview.css'.\n") DieDiag("Cannot find 'scanview.css'.\n")
if (! -r $CSS); if (! -r $CSS);
system ("cp", $CSS, "$Dir"); copy($CSS, "$Dir");
DieDiag("Could not copy 'scanview.css' to '$Dir'.\n") DieDiag("Could not copy 'scanview.css' to '$Dir'.\n")
if (! -r $CSS); if (! -r $CSS);
...@@ -523,7 +525,7 @@ sub Postprocess { ...@@ -523,7 +525,7 @@ sub Postprocess {
if (scalar(@filesFound) == 0 and ! -e "$Dir/failures") { if (scalar(@filesFound) == 0 and ! -e "$Dir/failures") {
if (! $KeepEmpty) { if (! $KeepEmpty) {
Diag("Removing directory '$Dir' because it contains no reports.\n"); Diag("Removing directory '$Dir' because it contains no reports.\n");
system ("rm", "-fR", $Dir); rmtree($Dir) or die "Cannot rmtree '$Dir' : $!";
} }
Diag("No bugs found.\n"); Diag("No bugs found.\n");
return 0; return 0;
...@@ -844,8 +846,8 @@ ENDTEXT ...@@ -844,8 +846,8 @@ ENDTEXT
CopyFiles($Dir); CopyFiles($Dir);
# Make sure $Dir and $BaseDir are world readable/executable. # Make sure $Dir and $BaseDir are world readable/executable.
system("chmod", "755", $Dir); chmod(0755, $Dir);
if (defined $BaseDir) { system("chmod", "755", $BaseDir); } if (defined $BaseDir) { chmod(0755, $BaseDir); }
# Print statistics # Print statistics
print CalcStats(\@Stats) if $AnalyzerStats; print CalcStats(\@Stats) if $AnalyzerStats;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment