diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-06-04 11:52:03 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-06-04 14:18:27 +0200 |
commit | 3717d76830fb6474cf7671c0fb6c741fd0b1a754 (patch) | |
tree | 6afae1b304dc122e2762099fbdda0698be5ffa2e | |
parent | eb123aab3957894985aad8a97b5b8ff1bb6d2faa (diff) | |
download | qttools-3717d76830fb6474cf7671c0fb6c741fd0b1a754.tar.gz |
windeployqt: Fix runProcess().
Use workingDirectory parameter and allow for long command lines.
Change-Id: I883eb569c82b0615d159f04dcf9991378164b777
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
-rw-r--r-- | src/windeployqt/utils.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/windeployqt/utils.cpp b/src/windeployqt/utils.cpp index 086d5b0b8..2deddc1d6 100644 --- a/src/windeployqt/utils.cpp +++ b/src/windeployqt/utils.cpp @@ -46,6 +46,7 @@ #include <QtCore/qt_windows.h> #include <QtCore/QTemporaryFile> #include <QtCore/QScopedPointer> +#include <QtCore/QScopedArrayPointer> #include <QtCore/QStandardPaths> #include <cstdio> @@ -187,15 +188,11 @@ bool runProcess(const QString &commandLine, const QString &workingDirectory, } // Create a copy of the command line which CreateProcessW can modify. - if (commandLine.size() >= MAX_PATH) { - if (errorMessage) - *errorMessage = QStringLiteral("Command line too long."); - return false; - } - wchar_t commandLineW[MAX_PATH]; - commandLine.toWCharArray(commandLineW); + QScopedArrayPointer<wchar_t> commandLineW(new wchar_t[commandLine.size() + 1]); + commandLine.toWCharArray(commandLineW.data()); commandLineW[commandLine.size()] = 0; - if (!CreateProcessW(0, commandLineW, 0, 0, /* InheritHandles */ TRUE, 0, 0, 0, &si, &pi)) { + if (!CreateProcessW(0, commandLineW.data(), 0, 0, /* InheritHandles */ TRUE, 0, 0, + (wchar_t *)nativeWorkingDir.utf16(), &si, &pi)) { if (stdOut) CloseHandle(si.hStdOutput); if (stdErr) |