mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixup mtr_unique. Remove usage of ps and grep. Make it a module. Move _process_alive to Platform.pm. Rename opt_baseport to baseport, it's not an option
This commit is contained in:
@ -21,7 +21,7 @@ use strict;
|
||||
use base qw(Exporter);
|
||||
our @EXPORT= qw(IS_CYGWIN IS_WINDOWS IS_WIN32PERL
|
||||
native_path posix_path mixed_path
|
||||
check_socket_path_length);
|
||||
check_socket_path_length process_alive);
|
||||
|
||||
BEGIN {
|
||||
if ($^O eq "cygwin") {
|
||||
@ -123,4 +123,16 @@ sub check_socket_path_length {
|
||||
}
|
||||
|
||||
|
||||
sub process_alive {
|
||||
my ($pid)= @_;
|
||||
die "usage: process_alive(pid)" unless $pid;
|
||||
|
||||
return kill(0, $pid) unless IS_WINDOWS;
|
||||
|
||||
my @list= split(/,/, `tasklist /FI "PID eq $pid" /NH /FO CSV`);
|
||||
my $ret_pid= eval($list[1]);
|
||||
return ($ret_pid == $pid);
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
Reference in New Issue
Block a user