mirror of
https://github.com/curl/curl.git
synced 2026-05-14 08:56:22 +03:00
processhelp.pm: fix to use the correct null device on Windows
To not create a file named `nul` in the `tests` directory when running tests with MSYS2/Cygwin Perl (the only supported Perl for Windows). I imagine this may cause issues when being written in parallel. Also `nul` is a reserved filename on Windows. Closes #18282
This commit is contained in:
parent
d63e40f8e6
commit
c24d4be057
1 changed files with 7 additions and 3 deletions
|
|
@ -65,6 +65,10 @@ use pathhelp qw(
|
|||
os_is_win
|
||||
);
|
||||
|
||||
use globalconfig qw(
|
||||
$dev_null
|
||||
);
|
||||
|
||||
#######################################################################
|
||||
# portable_sleep uses Time::HiRes::sleep if available and falls back
|
||||
# to the classic approach of using select(undef, undef, undef, ...).
|
||||
|
|
@ -143,7 +147,7 @@ sub pidexists {
|
|||
if($^O ne 'MSWin32') {
|
||||
my $filter = "PID eq $pid";
|
||||
# https://ss64.com/nt/tasklist.html
|
||||
my $result = `tasklist -fi \"$filter\" 2>nul`;
|
||||
my $result = `tasklist -fi \"$filter\" 2>$dev_null`;
|
||||
if(index($result, "$pid") != -1) {
|
||||
return -$pid;
|
||||
}
|
||||
|
|
@ -173,7 +177,7 @@ sub pidterm {
|
|||
$pid -= 4194304;
|
||||
if($^O ne 'MSWin32') {
|
||||
# https://ss64.com/nt/taskkill.html
|
||||
my $cmd = "taskkill -f -t -pid $pid >nul 2>&1";
|
||||
my $cmd = "taskkill -f -t -pid $pid >$dev_null 2>&1";
|
||||
print "Executing: '$cmd'\n";
|
||||
system($cmd);
|
||||
return;
|
||||
|
|
@ -198,7 +202,7 @@ sub pidkill {
|
|||
$pid -= 4194304;
|
||||
if($^O ne 'MSWin32') {
|
||||
# https://ss64.com/nt/taskkill.html
|
||||
my $cmd = "taskkill -f -t -pid $pid >nul 2>&1";
|
||||
my $cmd = "taskkill -f -t -pid $pid >$dev_null 2>&1";
|
||||
print "Executing: '$cmd'\n";
|
||||
system($cmd);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue