Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QProcess, detect if process is already running?
Is there a way to check if a process is already running by looking up its name or path and if so can I get the PID of it?
I've searched for a solution and the results seem a bit vague.
@SPlatten Not in Qt. I think you will need to use platform specific APIs or call command line tools like "ps" on Linux.
@jsulm , thank you, I've done this before not using Qt, I'll do the same again.
@jsulm , what would it take to prompt Qt to explorer this and implement a solution? It strikes me this is a gapping hole in the whole multi-platform solution as you say Qt doesn't currently support it, which means unfortunately that having in order to implement a multi-platform solution I need to resort to different solutions for each platform.
what would it take to prompt Qt to explorer this and implement a solution?
This is something you need to ask actual Qt developers as this is user forum. You can even file change request in Qt bug tracker. Checking whether there is a process executing a specific executable is a rare use case, so I doubt it has a high priority.
SPlatten last edited by SPlatten
@jsulm, thank you, I will do that now. The implementation I wrote was in Java.
Bonnie last edited by
FYI, in the source code of Qt installer framework, there's a KD Tools Library with a
runningProcesses()function which may be helpful.
It has implementations for different platforms in:
@Bonnie , thank you, I will take a look now.