forked from qt-creator/qt-creator
Utils: Support relative path for PtyProcess
Change-Id: I8af96e51a4b75c192f5fab339449f4d07b1a040a Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -345,6 +345,23 @@ public:
|
||||
|
||||
void doDefaultStart(const QString &program, const QStringList &arguments) final
|
||||
{
|
||||
QString executable = program;
|
||||
FilePath path = FilePath::fromUserInput(executable);
|
||||
if (!path.isAbsolutePath()) {
|
||||
path = path.searchInPath();
|
||||
if (path.isEmpty()) {
|
||||
const ProcessResultData result
|
||||
= {0,
|
||||
QProcess::CrashExit,
|
||||
QProcess::FailedToStart,
|
||||
Tr::tr("The program \"%1\" could not be found.").arg(program)};
|
||||
emit done(result);
|
||||
return;
|
||||
}
|
||||
|
||||
executable = path.nativePath();
|
||||
}
|
||||
|
||||
QTC_CHECK(m_setup.m_ptyData);
|
||||
m_setup.m_ptyData->setResizeHandler([this](const QSize &size) {
|
||||
if (m_ptyProcess)
|
||||
@@ -365,15 +382,15 @@ public:
|
||||
penv = Environment::systemEnvironment().toProcessEnvironment();
|
||||
const QStringList senv = penv.toStringList();
|
||||
|
||||
bool startResult
|
||||
= m_ptyProcess->startProcess(program,
|
||||
HostOsInfo::isWindowsHost()
|
||||
? QStringList{m_setup.m_nativeArguments} << arguments
|
||||
: arguments,
|
||||
m_setup.m_workingDirectory.nativePath(),
|
||||
senv,
|
||||
m_setup.m_ptyData->size().width(),
|
||||
m_setup.m_ptyData->size().height());
|
||||
bool startResult = m_ptyProcess->startProcess(executable,
|
||||
HostOsInfo::isWindowsHost()
|
||||
? QStringList{m_setup.m_nativeArguments}
|
||||
<< arguments
|
||||
: arguments,
|
||||
m_setup.m_workingDirectory.nativePath(),
|
||||
senv,
|
||||
m_setup.m_ptyData->size().width(),
|
||||
m_setup.m_ptyData->size().height());
|
||||
|
||||
if (!startResult) {
|
||||
const ProcessResultData result = {-1,
|
||||
|
||||
Reference in New Issue
Block a user