flet
flet copied to clipboard
Flet desktop client should communicate its PID to a calling Python process
https://github.com/flet-dev/flet/blob/05a6e8c32696b0e622139c3ee2aa2bed03ee363a/sdk/python/flet/flet.py#L148-L153
When Flet client is started on macOS with open Flet.app (which is a bundle) a new open process is started which starts in its turn flet process which stays active while open dies. I didn't find a better way to find out flet process PID rather than incrementing open PID. Does it look like a hack? Yes. Would be happy to fix it if someone can provide a better solution.
A common solution is to create a temporal file with name given by the main process, and write pid into file. Here is an example that the subprocess use a temporal file to tell the main process which port it uses: https://github.com/wandb/wandb/blob/6ef7dbbb2c9f36a3ff73f05e519e26f5c5ca2aca/wandb/sdk/service/service.py https://github.com/wandb/wandb/blob/6ef7dbbb2c9f36a3ff73f05e519e26f5c5ca2aca/wandb/sdk/service/port_file.py WDYT?
You are right and thanks for the links to a solution! I'm going to rename this issue and fix in the next releases.
Additional sources: https://stackoverflow.com/questions/56553771/how-to-get-current-pid-of-current-process-in-dart
It's been fixed.