Detect whether "wineserver" is fully started? Signal? File?

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
smernst
Newbie
Newbie
Posts: 1
Joined: Fri Jun 09, 2017 4:41 am

Detect whether "wineserver" is fully started? Signal? File?

Post by smernst »

I am writing a Python script, which starts (and quits) its own dedicated wineserver with its own prefix.

Code: Select all

os.environ['WINEPREFIX'] = '/some/path'
proc_wineserver = subprocess.Popen(
	['wineserver', '-f', '-p'], # run persistent in foreground
	stdin = subprocess.PIPE,
	stdout = subprocess.PIPE,
	stderr = subprocess.PIPE,
	shell = False
	)
time.sleep(1) # Wait one second to ensure that wineserver is actually up and running. BETTER SOLUTION?
This happens in its own thread, so I can eventually quit the wineserver again while it allows me to capture its output in the meantime. Now I want to start and stop exe files on top of that as I please but only when my dedicated wineserver is actually completely up and running.

At the moment, I simply sleep for one second, which is odd on faster PCs and really not enough on somewhat older hardware (or with slow harddrives instead of SSDs). Not to mention that it looks stupid ;-)

Is there a signal I can catch or a file I can check (and wait for in a loop to appear) or anything else which would allow me a clean(er) solution?
madewokherd
Level 4
Level 4
Posts: 144
Joined: Mon Jun 02, 2008 5:03 pm

Re: Detect whether "wineserver" is fully started? Signal? Fi

Post by madewokherd »

If you want to know whether wineserver is running at all, use wineserver -k0

If you want to know whether the startup process is complete, I suggest running an exe command line that does nothing, such as cmd /c
Locked