Skip to content

Commit 7eb7b49

Browse files
committed
test.
Signed-off-by: andreidanila1 <andrei.danila@analog.com>
1 parent d7c86d4 commit 7eb7b49

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

ci/general/scopy.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[Desktop Entry]
22
Icon=scopy
33
Exec=scopy
4-
Terminal=false
4+
Terminal=true
55
Type=Application
66
Categories=Science
77
Name=Scopy

core/src/application_restarter.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ QStringList ApplicationRestarter::buildSudoEnvArgs()
7979
QStringList envArgs;
8080

8181
for(const QString &key : envKeys) {
82+
qWarning() << "[SUDO]"
83+
<< "key:" << key << "value:" << env.value(key);
8284
envArgs << QString("%1=%2").arg(key, env.value(key));
8385
}
8486

@@ -88,13 +90,17 @@ QStringList ApplicationRestarter::buildSudoEnvArgs()
8890
#ifdef __linux__
8991
void ApplicationRestarter::triggerRestartWithSudo()
9092
{
93+
qWarning() << "[SUDO]"
94+
<< "Entered in triggerRestartWithSudo() - UID" << getuid();
9195
if(getuid() == 0) {
9296
return;
9397
}
9498

9599
ApplicationRestarter *instance = GetInstance();
96100
QString executable;
97101

102+
qWarning() << "[SUDO]"
103+
<< "qEnvironmentVariable(APPIMAGE):" << qEnvironmentVariable("APPIMAGE");
98104
#ifdef __appimage__
99105
executable = qEnvironmentVariable("APPIMAGE");
100106
if(executable.isEmpty()) {
@@ -104,7 +110,8 @@ void ApplicationRestarter::triggerRestartWithSudo()
104110
#else
105111
executable = QFileInfo(instance->m_executable).absoluteFilePath();
106112
#endif
107-
113+
qWarning() << "[SUDO]"
114+
<< "executable:" << executable;
108115
QStringList pkexecArgs;
109116
pkexecArgs << "env"
110117
<< "-i"
@@ -113,8 +120,13 @@ void ApplicationRestarter::triggerRestartWithSudo()
113120
pkexecArgs << executable;
114121
pkexecArgs << instance->m_arguments;
115122

123+
qWarning() << "[SUDO]"
124+
<< "pkexecargs:" << pkexecArgs;
125+
116126
QProcess::startDetached("pkexec", pkexecArgs, instance->m_currentPath);
117127
instance->m_restart = false;
118128
qApp->exit();
129+
qWarning() << "[SUDO]"
130+
<< "exit triggerRestartWithSudo";
119131
}
120132
#endif

0 commit comments

Comments
 (0)