Skip to content

Commit 2bbf5dd

Browse files
committed
fix: ll-package-manager process start abnormal
Remove the DBus connection check for ll-package-manager and always start a new process. The previous logic attempted to reuse an existing instance but the connection check was unreliable and introduced complexity. Simplify by always spawning a new process via sudo and sleeping to ensure readiness. Log: ll-cli now always starts a new package-manager process instead of reusing existing one Influence: 1. Test normal command execution after the change 2. Verify that only one package-manager process runs when invoked multiple times (if needed) 3. Ensure that existing operations (install, remove, etc.) still work correctly 4. Check for any race conditions or startup failures due to concurrent launches 5. Validate that the sleeping interval (1s) is sufficient for the package-manager to initialize
1 parent a38a61c commit 2bbf5dd

1 file changed

Lines changed: 9 additions & 18 deletions

File tree

apps/ll-cli/src/main.cpp

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -714,24 +714,15 @@ You can report bugs to the linyaps team under this project: https://github.com/O
714714
return -1;
715715
}
716716

717-
const auto pkgManAddress = QString("unix:path=/tmp/linglong-package-manager.socket");
718-
719-
// Check if ll-package-manager is already running
720-
auto pkgManConn = QDBusConnection::connectToPeer(pkgManAddress, "ll-package-manager");
721-
if (!pkgManConn.isConnected()) {
722-
// Only start a new process if no existing one is listening
723-
startProcess("sudo",
724-
{ "--user",
725-
LINGLONG_USERNAME,
726-
"--preserve-env=QT_FORCE_STDERR_LOGGING",
727-
"--preserve-env=QDBUS_DEBUG",
728-
LINGLONG_LIBEXEC_DIR "/ll-package-manager",
729-
"--no-dbus" });
730-
using namespace std::chrono_literals;
731-
std::this_thread::sleep_for(1s);
732-
} else {
733-
LogD("ll-package-manager is already running, reuse existing process");
734-
}
717+
startProcess("sudo",
718+
{ "--user",
719+
LINGLONG_USERNAME,
720+
"--preserve-env=QT_FORCE_STDERR_LOGGING",
721+
"--preserve-env=QDBUS_DEBUG",
722+
LINGLONG_LIBEXEC_DIR "/ll-package-manager",
723+
"--no-dbus" });
724+
using namespace std::chrono_literals;
725+
std::this_thread::sleep_for(1s);
735726
}
736727
auto repo = linglong::repo::OSTreeRepo::loadFromPath(LINGLONG_ROOT);
737728
if (!repo.has_value()) {

0 commit comments

Comments
 (0)