]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
runtests: pass single backslashes with Windows Perl
authorViktor Szakats <commit@vsz.me>
Fri, 4 Oct 2024 20:38:14 +0000 (22:38 +0200)
committerViktor Szakats <commit@vsz.me>
Tue, 29 Oct 2024 08:20:37 +0000 (09:20 +0100)
handle/handle64 requires a literal match with the filenames it's
listing.

Also:
- make handle64 log messages more unique to help text searches.
- update a comment with Windows Perl info.

Cherry-picked from #14949
Closes #15436

tests/runner.pm
tests/servers.pm

index 566fd5f5160f6b370d13634cccce59655566d3c9..deb7920e79cd94adbe6ab1860e8e39f56318dfb0 100644 (file)
@@ -192,7 +192,7 @@ sub runner_init {
             $SIG{INT} = 'IGNORE';
             $SIG{TERM} = 'IGNORE';
             eval {
-                # some msys2 perl versions don't define SIGUSR1
+                # some msys2 perl versions don't define SIGUSR1, also missing from Win32 Perl
                 $SIG{USR1} = 'IGNORE';
             };
 
index 216ec74be88a13078ee26f4b12a731d8f4a3ad2d..2648babdb9fb358f3ae9953c1b9df587a233ce00 100644 (file)
@@ -272,7 +272,12 @@ sub clearlocks {
 
     if(os_is_win()) {
         $dir = sys_native_abs_path($dir);
-        $dir =~ s/\//\\\\/g;
+        if ($^O eq 'MSWin32') {
+            $dir =~ s/\//\\/g;
+        }
+        else {
+            $dir =~ s/\//\\\\/g;
+        }
         my $handle = "handle";
         if($ENV{"PROCESSOR_ARCHITECTURE"} =~ /64$/) {
             $handle = "handle64";
@@ -280,18 +285,18 @@ sub clearlocks {
         if(checkcmd($handle)) {
             # https://learn.microsoft.com/sysinternals/downloads/handle#usage
             my $cmd = "$handle $dir -accepteula -nobanner";
-            logmsg "Executing: '$cmd'\n";
+            logmsg "clearlocks: Executing query: '$cmd'\n";
             my @handles = `$cmd`;
             for my $tryhandle (@handles) {
                 # Skip the "No matching handles found." warning when returned
                 if($tryhandle =~ /^(\S+)\s+pid:\s+(\d+)\s+type:\s+(\w+)\s+([0-9A-F]+):\s+(.+)\r\r/) {
-                    logmsg "Found $3 lock of '$5' ($4) by $1 ($2)\n";
+                    logmsg "clearlocks: Found $3 lock of '$5' ($4) by $1 ($2)\n";
                     # Ignore stunnel since we cannot do anything about its locks
                     if("$3" eq "File" && "$1" ne "tstunnel.exe") {
-                        logmsg "Killing IMAGENAME eq $1 and PID eq $2\n";
+                        logmsg "clearlocks: Killing IMAGENAME eq $1 and PID eq $2\n";
                         # https://ss64.com/nt/taskkill.html
                         my $cmd = "taskkill.exe -f -t -fi \"IMAGENAME eq $1\" -fi \"PID eq $2\" >nul 2>&1";
-                        logmsg "Executing: '$cmd'\n";
+                        logmsg "clearlocks: Executing kill: '$cmd'\n";
                         system($cmd);
                         $done = 1;
                     }