CommandLine: Find executable in PATH when it is relative

Task-number: QTCREATORBUG-26329
Change-Id: Ie7b30ea5c73d11e4a9961bdaa732ee36e0e377e7
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Orgad Shaneh
2021-09-29 15:05:24 +03:00
committed by Orgad Shaneh
parent f2a157897f
commit 13067a7d9c

View File

@@ -647,8 +647,10 @@ void ProcessArgs::addArgs(QString *args, const QStringList &inArgs)
bool ProcessArgs::prepareCommand(const CommandLine &cmdLine, QString *outCmd, ProcessArgs *outArgs, bool ProcessArgs::prepareCommand(const CommandLine &cmdLine, QString *outCmd, ProcessArgs *outArgs,
const Environment *env, const FilePath *pwd) const Environment *env, const FilePath *pwd)
{ {
const FilePath executable = cmdLine.executable(); FilePath executable = cmdLine.executable();
const QString arguments = cmdLine.arguments(); const QString arguments = cmdLine.arguments();
if (env && executable.isRelativePath())
executable = env->searchInPath(executable.toString());
ProcessArgs::SplitError err; ProcessArgs::SplitError err;
*outArgs = ProcessArgs::prepareArgs(arguments, &err, executable.osType(), env, pwd); *outArgs = ProcessArgs::prepareArgs(arguments, &err, executable.osType(), env, pwd);
if (err == ProcessArgs::SplitOk) { if (err == ProcessArgs::SplitOk) {