forked from qt-creator/qt-creator
RemoteLinux: Honor working directory setting again
Fixes: QTCREATORBUG-28900 Change-Id: I163877a749f378b2aa7579c1985e58f8a9d87e2c Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
#include <utils/filestreamer.h>
|
#include <utils/filestreamer.h>
|
||||||
#include <utils/filestreamermanager.h>
|
#include <utils/filestreamermanager.h>
|
||||||
#include <utils/processinterface.h>
|
#include <utils/processinterface.h>
|
||||||
|
#include <utils/qtcprocess.h>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
@@ -181,6 +182,21 @@ void FileSystemAccessTest::testCreateRemoteFile()
|
|||||||
QVERIFY(!testFilePath.exists());
|
QVERIFY(!testFilePath.exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileSystemAccessTest::testWorkingDirectory()
|
||||||
|
{
|
||||||
|
const FilePath dir = baseFilePath() / "testdir with space and 'various' \"quotes\" here";
|
||||||
|
QVERIFY(dir.ensureWritableDir());
|
||||||
|
QtcProcess proc;
|
||||||
|
proc.setCommand({"pwd", {}});
|
||||||
|
proc.setWorkingDirectory(dir);
|
||||||
|
proc.start();
|
||||||
|
QVERIFY(proc.waitForFinished());
|
||||||
|
const QString out = proc.readAllStandardOutput().trimmed();
|
||||||
|
QCOMPARE(out, dir.path());
|
||||||
|
const QString err = proc.readAllStandardOutput();
|
||||||
|
QVERIFY(err.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
void FileSystemAccessTest::testDirStatus()
|
void FileSystemAccessTest::testDirStatus()
|
||||||
{
|
{
|
||||||
FilePath filePath = baseFilePath();
|
FilePath filePath = baseFilePath();
|
||||||
|
@@ -24,6 +24,7 @@ private slots:
|
|||||||
|
|
||||||
void testCreateRemoteFile_data();
|
void testCreateRemoteFile_data();
|
||||||
void testCreateRemoteFile();
|
void testCreateRemoteFile();
|
||||||
|
void testWorkingDirectory();
|
||||||
void testDirStatus();
|
void testDirStatus();
|
||||||
void testBytesAvailable();
|
void testBytesAvailable();
|
||||||
void testFileActions();
|
void testFileActions();
|
||||||
|
@@ -612,13 +612,17 @@ void SshProcessInterfacePrivate::start()
|
|||||||
cmd.addArg("-tt");
|
cmd.addArg("-tt");
|
||||||
|
|
||||||
const CommandLine full = q->m_setup.m_commandLine;
|
const CommandLine full = q->m_setup.m_commandLine;
|
||||||
if (!full.isEmpty()) {
|
if (!full.isEmpty()) { // Empty is ok in case of opening a terminal.
|
||||||
|
CommandLine inner;
|
||||||
|
const QString wd = q->m_setup.m_workingDirectory.path();
|
||||||
|
if (!wd.isEmpty())
|
||||||
|
inner.addCommandLineWithAnd({"cd", {wd}});
|
||||||
if (!useTerminal) {
|
if (!useTerminal) {
|
||||||
// Empty is ok in case of opening a terminal.
|
const QString pidArg = QString("%1\\$\\$%1").arg(QString::fromLatin1(s_pidMarker));
|
||||||
cmd.addArgs(QString("echo ") + s_pidMarker + "\\$\\$" + s_pidMarker + " \\&\\& ",
|
inner.addCommandLineWithAnd({"echo", pidArg, CommandLine::Raw});
|
||||||
CommandLine::Raw);
|
|
||||||
}
|
}
|
||||||
cmd.addCommandLineAsArgs(full, CommandLine::Raw);
|
inner.addCommandLineWithAnd(full);
|
||||||
|
cmd.addCommandLineAsSingleArg(inner);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_process.setProcessImpl(q->m_setup.m_processImpl);
|
m_process.setProcessImpl(q->m_setup.m_processImpl);
|
||||||
|
Reference in New Issue
Block a user