mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user