From 62dfa93458618e1b33a0bc39e4a5d3831b92ded1 Mon Sep 17 00:00:00 2001 From: Richard K Miller Date: Wed, 4 Sep 2013 10:29:01 -0600 Subject: [PATCH 1/3] cli_set_process_title() available in PHP 5.5 to set proc title. This is preferred over the PECL function setproctitle(). --- lib/Resque/Worker.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Resque/Worker.php b/lib/Resque/Worker.php index a6c3985..1c9219a 100644 --- a/lib/Resque/Worker.php +++ b/lib/Resque/Worker.php @@ -324,7 +324,10 @@ class Resque_Worker */ private function updateProcLine($status) { - if(function_exists('setproctitle')) { + if(function_exists('cli_set_process_title')) { + cli_set_process_title('resque-' . Resque::VERSION . ': ' . $status); + } + else if(function_exists('setproctitle')) { setproctitle('resque-' . Resque::VERSION . ': ' . $status); } } From 6ed8fc048f1a82865ac3ff74e0f7dc26be1d7811 Mon Sep 17 00:00:00 2001 From: Richard K Miller Date: Wed, 4 Sep 2013 12:29:38 -0600 Subject: [PATCH 2/3] refactor process title to keep it DRY --- lib/Resque/Worker.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Resque/Worker.php b/lib/Resque/Worker.php index 1c9219a..d74505c 100644 --- a/lib/Resque/Worker.php +++ b/lib/Resque/Worker.php @@ -324,11 +324,12 @@ class Resque_Worker */ private function updateProcLine($status) { + $processTitle = 'resque-' . Resque::VERSION . ': ' . $status; if(function_exists('cli_set_process_title')) { - cli_set_process_title('resque-' . Resque::VERSION . ': ' . $status); + cli_set_process_title($processTitle); } else if(function_exists('setproctitle')) { - setproctitle('resque-' . Resque::VERSION . ': ' . $status); + setproctitle($processTitle); } } From 9335ef51b463511f7a94c59048491b3f8990623e Mon Sep 17 00:00:00 2001 From: Richard K Miller Date: Wed, 4 Sep 2013 16:12:12 -0600 Subject: [PATCH 3/3] fix spaces that should be tabs --- lib/Resque/Worker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Resque/Worker.php b/lib/Resque/Worker.php index d74505c..7499039 100644 --- a/lib/Resque/Worker.php +++ b/lib/Resque/Worker.php @@ -324,7 +324,7 @@ class Resque_Worker */ private function updateProcLine($status) { - $processTitle = 'resque-' . Resque::VERSION . ': ' . $status; + $processTitle = 'resque-' . Resque::VERSION . ': ' . $status; if(function_exists('cli_set_process_title')) { cli_set_process_title($processTitle); }