Fix running as root

There is no need for TerminalRunner::setRunAsRoot()
as debugger is already being run as root.
Implement runAsRoot for non-terminal QtcProcess, too.

Fixes: QTCREATORBUG-26964
Change-Id: Id5110db86b7b809a5608714464241cee73875f2b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-02-01 14:51:23 +01:00
parent 2be0fc2537
commit 239688180d
9 changed files with 62 additions and 77 deletions

View File

@@ -3852,12 +3852,9 @@ void GdbEngine::setupEngine()
Environment gdbEnv = rp.debugger.environment;
gdbEnv.setupEnglishOutput();
if (rp.runAsRoot) {
CommandLine wrapped("sudo", {"-A"});
wrapped.addCommandLineAsArgs(gdbCommand);
gdbCommand = wrapped;
if (rp.runAsRoot)
RunControl::provideAskPassEntry(gdbEnv);
}
m_gdbProc.setRunAsRoot(rp.runAsRoot);
showMessage("STARTING " + gdbCommand.toUserOutput());