I'm developing an application in Qt.
First, I created a QProcess object :
process = new QProcess(this);
// launching plink by script
process->start(plinkLauncherScriptPath, arguments);
Script looks like this:
@echo off
echo y | "%~dp0/plink.exe" %1 -L %2
I get seesionID and everything seems ok, but the problem appears when I want to end this session and open a new one.
I try to kill process with :
QString write = "0x01";
process->write(write.toLatin1());
// process->terminate(); i tried this too
process->close();
// process->kill(); i tried this too
The process is killed, but PLINK.exe is still running (I see it in Windows task manager), and every new session creates another running instance.
From the application, I can only take pid of QProcess, not plink itself :
process->pid(); // here would be shown some id 0x875f50c8
process->processId(); // here would be shown some id 4936
process->close();
process->pid(); // here would be shown some id 0x0
process->processId(); // here would be shown some id 0
This code shows that QProcess is closed successfully, but plink still stays.
One option is to create another script which would kill all processes named "PLINK". It can look like this:
taskkill /im plink.exe
Unfortunately, by running it, I would kill all plink processes, even these ones which were launched by other programs.
Have you got any idea to solve this problem?