From 20e241737ea6fc25621362db83fb96a066b8498c Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 22 Jul 2022 10:16:39 +0200 Subject: [PATCH] Fix regression with permissions when running app locally Amends 3efa0f3961f53adda53157915a82707048acd3a6 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 --- src/plugins/projectexplorer/runcontrol.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp index f8da814b7a6..4a6539befff 100644 --- a/src/plugins/projectexplorer/runcontrol.cpp +++ b/src/plugins/projectexplorer/runcontrol.cpp @@ -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;