This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository x2goclient. from 7ce9039 Revert accidental config_win.bat code in 5bb4a33 "Add x2gohelper to start X2Go Client on Windows and clean child processes if X2Go Client crashes. (Fixes: #525)." new 560fe41 Follow-up commit for 5bb4a33. Add forgotten x2gohelper/ folder. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: x2gohelper/x2gohelper.cpp | 90 +++++++++++++++++++++++++++++++++++++++++++++ x2gohelper/x2gohelper.pro | 14 +++++++ 2 files changed, 104 insertions(+) create mode 100644 x2gohelper/x2gohelper.cpp create mode 100644 x2gohelper/x2gohelper.pro -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goclient. commit 560fe4125e65b12a2e3078123cf98d9ba82db10a Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Wed Jul 9 16:10:05 2014 +0200 Follow-up commit for 5bb4a33. Add forgotten x2gohelper/ folder. --- x2gohelper/x2gohelper.cpp | 90 +++++++++++++++++++++++++++++++++++++++++++++ x2gohelper/x2gohelper.pro | 14 +++++++ 2 files changed, 104 insertions(+) diff --git a/x2gohelper/x2gohelper.cpp b/x2gohelper/x2gohelper.cpp new file mode 100644 index 0000000..5f0bd42 --- /dev/null +++ b/x2gohelper/x2gohelper.cpp @@ -0,0 +1,90 @@ +/************************************************************************** +* Copyright (C) 2005-2014 by Oleksandr Shneyder * +* o.shneyder@phoca-gmbh.de * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see <http://www.gnu.org/licenses/>. * +***************************************************************************/ +#include <iostream> +using namespace std; +#include <windows.h> +#include <TlHelp32.h> + +#include <QStringList> +#include <QProcess> +#include <QDebug> + +void killProcess(DWORD pid) +{ + HANDLE handle=OpenProcess(PROCESS_TERMINATE,0,pid); + if(!handle) + { + return; + } + if(!TerminateProcess(handle,0)) + { + return; + } + CloseHandle(handle); +} + +void enumerateFromParent(DWORD pid) +{ + HANDLE hndl=CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 ); + if(hndl==INVALID_HANDLE_VALUE) + { + qCritical()<<"failed to get system snapshot"; + return; + } + PROCESSENTRY32 pentry; + pentry.dwSize = sizeof( PROCESSENTRY32 ); + if( Process32First(hndl,&pentry)) + { + while(Process32Next(hndl,&pentry)) + { + if(pid==pentry.th32ParentProcessID) + { + enumerateFromParent(pentry.th32ProcessID); + killProcess(pentry.th32ProcessID); + } + } + } + CloseHandle(hndl); +} + +int main(int argc, char* argv[]) +{ + QStringList args; + //argv[0] is allways "x2gohelper.exe" + for(int i=1; i< argc; ++i) + { + args<<argv[i]; + } + QProcess proc; + QString executable="x2goclient.exe"; + proc.start(executable, args); + if(!proc.waitForStarted(4000)) + { + qCritical()<<"Can't start process"; + return -1; + } + DWORD pid=proc.pid()->dwProcessId; + while(!proc.waitForFinished(300)) + { + QString err=proc.readAllStandardError(); + QString out=proc.readAllStandardOutput(); + std::cerr<<err.toStdString(); + std::cout<<out.toStdString(); + } + enumerateFromParent(pid); + return 0; +} diff --git a/x2gohelper/x2gohelper.pro b/x2gohelper/x2gohelper.pro new file mode 100644 index 0000000..1ac685e --- /dev/null +++ b/x2gohelper/x2gohelper.pro @@ -0,0 +1,14 @@ +###################################################################### +# Automatically generated by qmake (2.01a) Di. Jul 8 10:58:26 2014 +###################################################################### + +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . + +# Input +SOURCES += x2gohelper.cpp +QT -= gui +CONFIG += static release +#CONFIG += console -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git