
Originally Posted by
wysota
What if you exchange your external process call with a different one, e.g. running notepad or something like that? Do you get the finished signal when you exit that external program?
I have another application that calls mysqldump to backup and restore the database, and I get finished signal.
Although I don't like, I found a workaround: at the last line of script I write something (e.g. "End") to stdout. Then I test the "end" as follows:
connect(proces, SIGNAL(readyReadStandardOutput()), this, SLOT(test()));
void Dialog::test() {
qDebug() << proces->readAllStandardOutput(); // "End"
}
connect(proces, SIGNAL(readyReadStandardOutput()), this, SLOT(test()));
void Dialog::test() {
qDebug() << proces->readAllStandardOutput(); // "End"
}
To copy to clipboard, switch view to plain text mode
I reviewed all documentation I found about Powershell, including my Holy Bible -I mean Windows 7 Resource Kit (paperback) Perhaps that's one of the Microsoft's undocumented quirks... 
Edit: (3 min. later)
I found the solution (no Qt problem). Apparently powershell does not run in the same way from the console or when is called from another program (noninteractive). If I add at end of script:
Get-Process Powershell | Stop-Process
I Stop * really * powershell and get finished signal, with QProcess::ExitStatus = 0.
The slot:
void Dialog
::procState(QProcess::ProcessState estat
) { qDebug() << estat;
}
void Dialog::procState(QProcess::ProcessState estat) {
qDebug() << estat;
}
To copy to clipboard, switch view to plain text mode
now shows the states: 1 (starting), 2 (running) and 0 (not running).
Thanks to all of you for making me think a little longer.
Bookmarks