[wpigui] Make wpi::gui::OpenURL() fork the process first (#5687)

execlp() replaces the current process image, which isn't desirable.
This commit is contained in:
Tyler Veness
2023-09-28 13:01:56 -07:00
committed by GitHub
parent d4fcd80b7b
commit 9e9583412e

View File

@@ -23,6 +23,10 @@ void wpi::gui::OpenURL(const std::string& url) {
#else
static constexpr const char* opencmd = "xdg-open";
#endif
execlp(opencmd, opencmd, url.c_str(), static_cast<const char*>(nullptr));
// If we forked into the child process, run execlp(), which replaces the
// current process image
if (fork() == 0) {
execlp(opencmd, opencmd, url.c_str(), static_cast<const char*>(nullptr));
}
#endif
}