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
|
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);
|
QTC_CHECK(m_setup.m_ptyData);
|
||||||
m_setup.m_ptyData->setResizeHandler([this](const QSize &size) {
|
m_setup.m_ptyData->setResizeHandler([this](const QSize &size) {
|
||||||
if (m_ptyProcess)
|
if (m_ptyProcess)
|
||||||
@@ -365,15 +382,15 @@ public:
|
|||||||
penv = Environment::systemEnvironment().toProcessEnvironment();
|
penv = Environment::systemEnvironment().toProcessEnvironment();
|
||||||
const QStringList senv = penv.toStringList();
|
const QStringList senv = penv.toStringList();
|
||||||
|
|
||||||
bool startResult
|
bool startResult = m_ptyProcess->startProcess(executable,
|
||||||
= m_ptyProcess->startProcess(program,
|
HostOsInfo::isWindowsHost()
|
||||||
HostOsInfo::isWindowsHost()
|
? QStringList{m_setup.m_nativeArguments}
|
||||||
? QStringList{m_setup.m_nativeArguments} << arguments
|
<< arguments
|
||||||
: arguments,
|
: arguments,
|
||||||
m_setup.m_workingDirectory.nativePath(),
|
m_setup.m_workingDirectory.nativePath(),
|
||||||
senv,
|
senv,
|
||||||
m_setup.m_ptyData->size().width(),
|
m_setup.m_ptyData->size().width(),
|
||||||
m_setup.m_ptyData->size().height());
|
m_setup.m_ptyData->size().height());
|
||||||
|
|
||||||
if (!startResult) {
|
if (!startResult) {
|
||||||
const ProcessResultData result = {-1,
|
const ProcessResultData result = {-1,
|
||||||
|
|||||||
Reference in New Issue
Block a user