mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:47:45 +00:00
Applications: Use spawn_or_show_error() for common spawn pattern
This commit is contained in:
parent
5e5a055455
commit
5fd5a03d1f
6 changed files with 18 additions and 44 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/ElapsedTimer.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Process.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibDesktop/Launcher.h>
|
||||
#include <LibGUI/Clipboard.h>
|
||||
|
@ -48,15 +49,10 @@ void FileResult::activate() const
|
|||
|
||||
void TerminalResult::activate() const
|
||||
{
|
||||
pid_t pid;
|
||||
char const* argv[] = { "Terminal", "-k", "-e", title().characters(), nullptr };
|
||||
|
||||
if ((errno = posix_spawn(&pid, "/bin/Terminal", nullptr, nullptr, const_cast<char**>(argv), environ))) {
|
||||
perror("posix_spawn");
|
||||
} else {
|
||||
if (disown(pid) < 0)
|
||||
perror("disown");
|
||||
}
|
||||
// FIXME: This should be a GUI::Process::spawn_or_show_error(), however this is a
|
||||
// Assistant::Result object, which does not have access to the application's GUI::Window* pointer
|
||||
// (which spawn_or_show_error() needs incase it has to open a error message box).
|
||||
(void)Core::Process::spawn("/bin/Terminal", Array { "-k", "-e", title().characters() });
|
||||
}
|
||||
|
||||
void URLResult::activate() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue