diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2016-05-30 17:22:05 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-03-31 12:40:07 +0000 |
commit | 31e782cc9609c2f1c201453841f36ed7dae25890 (patch) | |
tree | ebc59f03cb09855639df448d218d7f31f1ac874f /src/corelib/io/qprocess_win.cpp | |
parent | 6505062f58f6fe508267cc9fad7d0f87cc01847d (diff) |
Add non-static QProcess::startDetached
The three static QProcess::startDetached overloads support a limited number of
features: program, arguments and working directory. To support more features of
QProcess (without adding a plethora of overloads) we add a non-static method
startDetached that can be used as follows:
QProcess p;
p.setProgram("cat");
p.setArguments("meow");
p.setWorkingDirectory("/tmp");
if (!p.startDetached())
qWarning("Cannot start process.");
We plan to add support for nativeArguments, processEnvironment,
standard{Output|Error}File and maybe more in subsequent commits.
[ChangeLog][QtCore][QProcess] Added non-static QProcess::startDetached
to support more features for detached processes.
Task-number: QTBUG-2058
Task-number: QTBUG-2284
Task-number: QTBUG-37656
Task-number: QTBUG-52405
Task-number: QTBUG-57687
Change-Id: If6fdd57ecb28cd13aa5fff566216a4177f81d339
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Diffstat (limited to 'src/corelib/io/qprocess_win.cpp')
-rw-r--r-- | src/corelib/io/qprocess_win.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index 329d1842f0..4699936093 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -859,7 +859,7 @@ static bool startDetachedUacPrompt(const QString &programIn, const QStringList & return true; } -bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDir, qint64 *pid) +bool QProcessPrivate::startDetached(qint64 *pid) { static const DWORD errorElevationRequired = 740; @@ -876,7 +876,7 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a }; success = CreateProcess(0, (wchar_t*)args.utf16(), 0, 0, FALSE, dwCreationFlags, 0, - workingDir.isEmpty() ? 0 : (wchar_t*)workingDir.utf16(), + workingDirectory.isEmpty() ? 0 : (wchar_t*)workingDirectory.utf16(), &startupInfo, &pinfo); if (success) { @@ -885,7 +885,7 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a if (pid) *pid = pinfo.dwProcessId; } else if (GetLastError() == errorElevationRequired) { - success = startDetachedUacPrompt(program, arguments, workingDir, pid); + success = startDetachedUacPrompt(program, arguments, workingDirectory, pid); } return success; |