diff options
author | Magnus Svensson <msvensson@mysql.com> | 2008-08-10 19:46:43 +0200 |
---|---|---|
committer | Magnus Svensson <msvensson@mysql.com> | 2008-08-10 19:46:43 +0200 |
commit | 182b14114a8bc2a75f7d457b2bc11cca8017952d (patch) | |
tree | 60e1c6442c2dd28dc92df1d73a83b123ae118333 /mysql-test/lib/My/Platform.pm | |
parent | 36bebcc13cd165416db7c2ab10e2859e070a9eb3 (diff) | |
download | mariadb-git-182b14114a8bc2a75f7d457b2bc11cca8017952d.tar.gz |
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
Diffstat (limited to 'mysql-test/lib/My/Platform.pm')
-rw-r--r-- | mysql-test/lib/My/Platform.pm | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/mysql-test/lib/My/Platform.pm b/mysql-test/lib/My/Platform.pm index b934b08f522..1db6985771d 100644 --- a/mysql-test/lib/My/Platform.pm +++ b/mysql-test/lib/My/Platform.pm @@ -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; |