aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/xlaunch/main.cc
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-05-03 10:38:38 +0200
committermarha <marha@users.sourceforge.net>2012-05-03 10:38:38 +0200
commite219639a5f9f7d5f0fa40b9691c9dd596115d8ac (patch)
tree9ac5ab58557e1c7c3709beabda7ecb8dbb697a43 /xorg-server/hw/xwin/xlaunch/main.cc
parent4516768ad91d5dc0ad7d23b53e089dbe116244cd (diff)
downloadvcxsrv-e219639a5f9f7d5f0fa40b9691c9dd596115d8ac.tar.gz
vcxsrv-e219639a5f9f7d5f0fa40b9691c9dd596115d8ac.tar.bz2
vcxsrv-e219639a5f9f7d5f0fa40b9691c9dd596115d8ac.zip
Create hidden console when calling plink, otherwise some commands will
exit immediately (like gnome-terminal)
Diffstat (limited to 'xorg-server/hw/xwin/xlaunch/main.cc')
-rw-r--r--xorg-server/hw/xwin/xlaunch/main.cc24
1 files changed, 23 insertions, 1 deletions
diff --git a/xorg-server/hw/xwin/xlaunch/main.cc b/xorg-server/hw/xwin/xlaunch/main.cc
index 0a80630f0..730d7c547 100644
--- a/xorg-server/hw/xwin/xlaunch/main.cc
+++ b/xorg-server/hw/xwin/xlaunch/main.cc
@@ -598,7 +598,8 @@ class CMyWizard : public CWizard
host = config.user + "@" + config.host;
if (!config.remotepassword.empty())
remotepassword=std::string(" -pw ")+config.remotepassword;
- _snprintf(cmdline,512,"plink -ssh -X%s %s %s",
+ // Need to use -console since certain commands will not execute when no console
+ _snprintf(cmdline,512,"plink -console -ssh -X%s %s %s",
remotepassword.c_str(), host.c_str(),config.remoteprogram.c_str());
client += cmdline;
}
@@ -658,6 +659,24 @@ class CMyWizard : public CWizard
sic.wShowWindow = SW_HIDE;
// Start the child process.
+
+ // Create a console, otherwise some commands will not execute with plink
+ #ifdef WITH_FLASH
+ AllocConsole();
+ #else
+ HWINSTA h=GetProcessWindowStation();
+ HWINSTA horig=h;
+ if (h)
+ {
+ h=CreateWindowStationW(NULL, 0, STANDARD_RIGHTS_READ, NULL);
+ if (h)
+ SetProcessWindowStation(h);
+ AllocConsole();
+ SetProcessWindowStation(horig);
+ CloseWindowStation(h);
+ }
+ #endif
+
if( !CreateProcess( NULL, (CHAR*)client.c_str(), NULL, NULL,
FALSE, 0, NULL, CurDir, &sic, &pic ))
{
@@ -667,6 +686,9 @@ class CMyWizard : public CWizard
throw win32_error("CreateProcess failed", err);
}
handles[hcount++] = pic.hProcess;
+ #ifdef WITHFLASH
+ ShowWindow( GetConsoleWindow(), SW_HIDE ); // make it hidden
+ #endif
}
// Wait until any child process exits.