forked from qt-creator/qt-creator
Qnx: Use /tmp for temporary pid files
/var/run is not writable for users in a lot of setups. Change-Id: I510c04f6ee5887e3c58b3f6d4a2a870d9c0bc5a2 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -14,4 +14,6 @@ const char QNX_RUNCONFIG_ID[] = "Qt4ProjectManager.QNX.QNXRunConfiguration.";
|
||||
const char QNX_QNX_OS_TYPE[] = "QnxOsType"; // Also used for device type.
|
||||
const char QNX_TOOLCHAIN_ID[] = "Qnx.QccToolChain";
|
||||
|
||||
const char QNX_TMP_DIR[] = "/tmp"; // /var/run is root:root drwxr-xr-x
|
||||
|
||||
} // Qnx::Constants
|
||||
|
@@ -42,7 +42,7 @@ static std::atomic_int s_pidFileCounter = 1;
|
||||
|
||||
QnxProcessImpl::QnxProcessImpl(const LinuxDevice *linuxDevice)
|
||||
: SshProcessInterface(linuxDevice)
|
||||
, m_pidFile(QString::fromLatin1("/var/run/qtc.%1.pid").arg(s_pidFileCounter.fetch_add(1)))
|
||||
, m_pidFile(QString("%1/qtc.%2.pid").arg(Constants::QNX_TMP_DIR).arg(s_pidFileCounter.fetch_add(1)))
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -2,6 +2,8 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qnxdevicetester.h"
|
||||
|
||||
#include "qnxconstants.h"
|
||||
#include "qnxdevice.h"
|
||||
#include "qnxtr.h"
|
||||
|
||||
@@ -58,10 +60,11 @@ void QnxDeviceTester::testDevice(const ProjectExplorer::IDevice::Ptr &deviceConf
|
||||
using namespace Tasking;
|
||||
|
||||
auto setupHandler = [this](QtcProcess &process) {
|
||||
emit progressMessage(Tr::tr("Checking that files can be created in /var/run..."));
|
||||
const CommandLine cmd {m_deviceConfiguration->filePath("/bin/sh"),
|
||||
{"-c", QLatin1String("rm %1 > /dev/null 2>&1; echo ABC > %1 && rm %1")
|
||||
.arg("/var/run/qtc_xxxx.pid")}};
|
||||
emit progressMessage(Tr::tr("Checking that files can be created in %1...")
|
||||
.arg(Constants::QNX_TMP_DIR));
|
||||
const QString pidFile = QString("%1/qtc_xxxx.pid").arg(Constants::QNX_TMP_DIR);
|
||||
const CommandLine cmd(m_deviceConfiguration->filePath("/bin/sh"),
|
||||
{"-c", QLatin1String("rm %1 > /dev/null 2>&1; echo ABC > %1 && rm %1").arg(pidFile)});
|
||||
process.setCommand(cmd);
|
||||
};
|
||||
auto doneHandler = [this](const QtcProcess &) {
|
||||
@@ -69,9 +72,9 @@ void QnxDeviceTester::testDevice(const ProjectExplorer::IDevice::Ptr &deviceConf
|
||||
};
|
||||
auto errorHandler = [this](const QtcProcess &process) {
|
||||
const QString message = process.result() == ProcessResult::StartFailed
|
||||
? Tr::tr("An error occurred while checking that files can be created in /var/run.")
|
||||
+ '\n' + process.errorString()
|
||||
: Tr::tr("Files cannot be created in /var/run.");
|
||||
? Tr::tr("An error occurred while checking that files can be created in %1.")
|
||||
.arg(Constants::QNX_TMP_DIR) + '\n' + process.errorString()
|
||||
: Tr::tr("Files cannot be created in %1.").arg(Constants::QNX_TMP_DIR);
|
||||
emit errorMessage(message + '\n');
|
||||
};
|
||||
m_genericTester->setExtraTests({Process(setupHandler, doneHandler, errorHandler)});
|
||||
|
Reference in New Issue
Block a user