WasatchPhotonics / ENLIGHTEN

Open-source spectroscopy application for controlling and taking measurements from Wasatch Photonics spectrometers.
https://wasatchphotonics.com/product-category/software/
MIT License
3 stars 6 forks source link

Prevent multiple instances of ENLIGHTEN from running in parallel #301

Open mzieg opened 11 months ago

mzieg commented 11 months ago

This has happened to a couple users recently.

We used to have this problem when ENLIGHTEN was multi-process, and sometimes zombie processes stayed up even when the GUI controller closed. We handled this (crudely) by running ENLIGHTEN from a batch file that automatically killed any hung processes:

@taskkill /f /im Enlighten.exe  /t 2> NUL
@taskkill /f /im KIAConsole.exe /t 2> NUL

enlighten.exe %1 %2 %3 %4 %5 %6 %7 %8 %9

@taskkill /f /im Enlighten.exe  /t 2> NUL
@taskkill /f /im KIAConsole.exe /t 2> NUL

We could probably do this more elegantly with something like this:

(If another instance of ENLIGHTEN.exe is running on a different pid, pop-up a messagebox to explain and then shutdown, all before attempting to connect to any spectrometers)