Fix regression with permissions when running app locally

Amends 3efa0f3961

The code path for running locally in some cases modifies the environment
(to support SUDO_ASKPASS), or the command (to support privacy settings
on macOS), but this was overwritten again after the above change.

This lead to e.g. the Qt camera example just crashing on macOS, instead
of the OS asking the user for permission to use the camera & microphone.

Change-Id: I41192bac736e4b07eb3530b37e35ad02a79e20a5
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2022-07-22 10:16:39 +02:00
parent 87212ba639
commit 20e241737e

View File

@@ -1394,20 +1394,18 @@ void SimpleTargetRunnerPrivate::start()
{
const bool isLocal = !m_command.executable().needsDevice();
CommandLine cmdLine = m_command;
Environment env = m_environment;
m_resultData = {};
QTC_ASSERT(m_state == Inactive, return);
if (isLocal) {
Environment env = m_environment;
if (m_runAsRoot)
RunControl::provideAskPassEntry(env);
m_process.setEnvironment(env);
WinDebugInterface::startIfNeeded();
CommandLine cmdLine = m_command;
if (HostOsInfo::isMacHost()) {
CommandLine disclaim(Core::ICore::libexecPath("disclaim"));
disclaim.addCommandLineAsArgs(cmdLine);
@@ -1415,7 +1413,6 @@ void SimpleTargetRunnerPrivate::start()
}
m_process.setRunAsRoot(m_runAsRoot);
m_process.setCommand(cmdLine);
}
const IDevice::ConstPtr device = DeviceManager::deviceForPath(m_command.executable());
@@ -1429,8 +1426,8 @@ void SimpleTargetRunnerPrivate::start()
m_stopRequested = false;
m_process.setCommand(m_command);
m_process.setEnvironment(m_environment);
m_process.setCommand(cmdLine);
m_process.setEnvironment(env);
m_process.setExtraData(m_extraData);
m_state = Run;