I have a (Linux) PyQt5 application with some widgets (buttons and input fields) and a QProcess object. I start the process by launching an rxvt(1) terminal emulator and feeding it the program that I want to execute. Something like this
winIdStr = str(int(self.term.winId()))
cmd = 'rxvt'
cmdOpts = []
cmdOpts.append('-bg'); cmdOpts.append('#5D6D7E')
cmdOpts.append('-fg'); cmdOpts.append('white')
cmdOpts.append('-embed'); cmdOpts.append(winIdStr)
cmdOpts.append('-e'); cmdOpts.append('./goo')
cmdOpts.append(count)
self.process.start(cmd, cmdOpts)
print(self.process.exitCode())
This is functionally working fine. However I need to make the following enhancements:
- Currently rxvt(1) exits when program (goo) runs to completion. I need to keep the rxvt around. I think there are multiple ways to do this. A) some terminal emulators allow a flag to keep the window. I could not find such a flag for rxvt. So if you know it, that would be nice. B) Perhaps QProcess has a property that keeps the window around. C) Have QProcess launch goo_guardian(1) which will then fork and exec goo(1) and will not exit. Sort of like a pause in DOS.
- I need to monitor this external process. I need to know if it is running, its process ID (in case it is wedged and I need to kill it). 2.1) I think the previous 1.C solution (with a guardian), can help me with this.
Any help from PyQt5 community is appreciated. FYI, target OS is Linux.