Python Forum
How do you wait for a daemon to reach a certain state with subprocess.popen()?
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do you wait for a daemon to reach a certain state with subprocess.popen()?
#2
You could read the stdout of the process, and when there's nothing left to read you know it's "ready"?

Here's some fake code I didn't test:
proc = subprocess.Popen(exe_path, stdout=subprocess.PIPE)
while proc.stdout.peek():
   output = proc.stdout.read()
# no more output (or we read input before the process wrote anything) 
Reply


Messages In This Thread
RE: How do you wait for a daemon to reach a certain state with subprocess.popen()? - by nilamo - Jul-07-2017, 04:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Understanding subprocess.Popen Pedroski55 6 259 May-12-2024, 10:46 AM
Last Post: Pedroski55
Information subprocess.Popen() suddenly giving me grief? davecotter 3 668 Dec-13-2023, 10:49 PM
Last Post: davecotter
  Use subprocess.Popen and time.sleep chucky831 2 1,990 Aug-11-2022, 07:53 PM
Last Post: carecavoador
  Wait til a date and time KatManDEW 2 1,469 Mar-11-2022, 08:05 PM
Last Post: KatManDEW
  wait for the first of these events Skaperen 4 2,033 Mar-07-2022, 08:46 PM
Last Post: Gribouillis
  how to do a two-way wait Skaperen 2 1,307 Mar-04-2022, 02:31 AM
Last Post: Skaperen
  Subprocess.Popen() not working when reading file path from csv file herwin 13 15,372 May-07-2021, 03:26 PM
Last Post: herwin
  Did subprocess.Popen() causes main routine to pause stdout? liudr 4 3,709 May-04-2021, 08:58 PM
Last Post: liudr
  disable subprocess.popen prompt echo paul18fr 1 2,055 Feb-04-2021, 02:50 AM
Last Post: Larz60+
  I have an index error inline 76 but I write the program in a way that cant reach tha abbaszandi 2 2,111 Nov-13-2020, 07:43 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020