[rabbitmq-discuss] "service rabbitmq-server start" hangs when using python's Popen from subprocess.

Tim Watson tim at rabbitmq.com
Tue Oct 16 12:34:12 BST 2012


When you run RabbitMQ on an rpm based distro using /sbin/service then the init script is going to redirect stdio, as you would expect for a service/daemon. You'll need to start RabbitMQ directly from the ./scripts/rabbitmq-server shell script I guess, if you want to grab stdio - or tail the logs? 

On 16 Oct 2012, at 11:47, Raphaël De GIUSTI wrote:

> Hi everyone,
> 
> Starting the rabbitmq-server service with python's Popen from subprocess makes it hang.
> 
> Here's the little snippet to reproduce it (tested on Fedora 16 + Python2.7 and Centos 6.3 + Python2.6)
> 
> from subprocess import PIPE, Popen
> proc = Popen('service rabbitmq-server start', shell=True, stderr=PIPE, stdout=PIPE)
> print proc.communicate()
> 
> Problem is with "stdout=PIPE", I think.
> 
> The following snippet works, using proc.wait()
> 
> from subprocess import PIPE, Popen
> proc = Popen('service rabbitmq-server start', shell=True, stderr=PIPE, stdout=PIPE)
> print proc.wait()
> 
> Any idea on how to fix it using proc.communicate() because I need feedback from the "subprocess.PIPE" ?
> 
> Thank you.
> 
> Raphael
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss



More information about the rabbitmq-discuss mailing list