> > > > ---------- Forwarded message ---------- >> From: Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> >> To: python-list@python.org >> Cc: >> Date: 16 Apr 2014 12:06:16 GMT >> Subject: Re: subprocess help >> On Wed, 16 Apr 2014 12:47:03 +0200, Влатко Станковиќ wrote: >> > Hello, >> > I'm having some sort of 'problem' when using subprocess calls. This is >> > the code snipet that i am using: >> > >> > capture_server1 = '''xvfb-run --auto-servernum ... ''' >> > server1_download = subprocess.Popen(shlex.split(capture_server1), >> > stdin=subprocess.PIPE, >> > stdout=subprocess.PIPE, >> > stderr=subprocess.PIPE) >> > >> > out_s1, err_s1 = server1_download.communicate() >> > time.sleep(2) >> What's the difference between the server1 code (shown above) and the >> server2 code (not shown, but identical as far as I can tell)? >> You have to identify what files are remaining open. What does the xvfb- >> run process do? What are the rest of the arguments? >> My guess is that, depending on the arguments, sometimes xvfb-run leaves >> files open even after the process terminates. You should monitor the open >> files with lsof which is available on most Linux systems. I don't know >> how to do that on other operating systems. >> My guess is that, depending on the arguments, sometimes xvfb-run leaves >> files open even after the process terminates. You should monitor the open >> files with lsof which is available on most Linux systems. I don't know >> how to do that on other operating systems. >> -- >> Steven > > > --
https://mail.python.org/mailman/listinfo/python-list xvfb-run accepts some parameters and calls CutyCapt with parameters for it The command is this: xvfb-run --auto-servernum --server-num=55 --server-args "-screen 0, > 1024x768x24" {0} --url="{1}" --private-browsing=on --out={2} So server1, opens a process with CutyCapt which points to server1 address/url, does its thing and saves the result in out Server2 in the other hand has a different address/url, different server-num, and different out As a workarround i've added close_fds=True, preexec_fn=os.setsid, and after communicate(), i am doing os.killpg(server1.pid, signal.SIGUSR1) Although i am not sure if this will work 100% because i have to wait X days until something crashes Any ideas are welcomed P.S. After adding os.killpg, lsof and ps aux dont show more than 4 or 5 xvfb and cutycapt processes while running Thanks and Regards
-- https://mail.python.org/mailman/listinfo/python-list