summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2011-07-15 11:24:42 +0100
committerSimon MacMullen <simon@rabbitmq.com>2011-07-15 11:24:42 +0100
commitfe3e2b20ae99b3f65284c6eaf3c2fdb1c2a4cebc (patch)
tree75d22b305171f41800bb22076a37d8f6537502ac
parent6ee924134ce95a4f081e93ca40c3070f5f65996d (diff)
downloadrabbitmq-server-fe3e2b20ae99b3f65284c6eaf3c2fdb1c2a4cebc.tar.gz
The problem with kill -0 is that its semantics are "could I send a signal to this process?" - i.e. it will fail if the process exists but is not owned by the current user. I think this is not quite what we're looking for, so let's use ps -p. I've tested that ps -p does the right thing on Linux and OS X, and it claims to work on FreeBSD and AIX too according to the manpages on the web. That's probably good enough.
-rw-r--r--src/rabbit_control.erl2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl
index b1680d95..9581f850 100644
--- a/src/rabbit_control.erl
+++ b/src/rabbit_control.erl
@@ -386,7 +386,7 @@ node_up(Node) ->
% rpc:call(os, getpid, []) at this point
pid_up(Pid) ->
with_os([{unix, fun () ->
- system("kill -0 " ++ Pid
+ system("ps -p " ++ Pid
++ " >/dev/null 2>&1") =:= 0
end},
{win32, fun () ->