From: Vincent van Ravesteijn Date: Tue, 18 Mar 2014 21:32:57 +0000 (+0100) Subject: Do not use QProcess::startDetached on Windows X-Git-Tag: 2.1.0rc1~26 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=d44b465efac83c795fd65b9a2fb15d49a561460e;p=features.git Do not use QProcess::startDetached on Windows QProcess::startDetached cannot provide environment variables. When the environment variables are set using the latexEnvCmdPrefix, a console window is shown every time a viewer is started. On Windows, this reverts commit 5225821242887ff552b7370df9c830af5f17d3b3. Fixes: #9035. --- diff --git a/src/support/Systemcall.cpp b/src/support/Systemcall.cpp index 0ab7685b5c..c42ed0c143 100644 --- a/src/support/Systemcall.cpp +++ b/src/support/Systemcall.cpp @@ -250,17 +250,29 @@ int Systemcall::startscript(Starttype how, string const & what, SystemcallPrivate d(infile, outfile, errfile); - - d.startProcess(cmd, path, how == DontWait); - if (how == DontWait && d.state == SystemcallPrivate::Running) { +#ifdef Q_OS_WIN32 + d.startProcess(cmd, path, false); + if (!d.waitWhile(SystemcallPrivate::Starting, process_events, -1)) { + LYXERR0("Systemcall: '" << cmd << "' did not start!"); + LYXERR0("error " << d.errorMessage()); + return 10; + } + if (how == DontWait) { + d.releaseProcess(); return 0; } +#else + d.startProcess(cmd, path, how == DontWait); + if (how == DontWait && d.state == SystemcallPrivate::Running) + return 0; + if (d.state == SystemcallPrivate::Error || !d.waitWhile(SystemcallPrivate::Starting, process_events, -1)) { LYXERR0("Systemcall: '" << cmd << "' did not start!"); LYXERR0("error " << d.errorMessage()); return 10; } +#endif if (!d.waitWhile(SystemcallPrivate::Running, process_events, os::timeout_min() * 60 * 1000)) {