mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-04 15:09:40 +00:00
FileManager: Launch applications with their AppFile-specified arguments
We should really use Core::Process here, but it does not yet support all posix_spawn features we are currently using.
This commit is contained in:
parent
7dd961c39f
commit
3990e630f2
|
@ -493,6 +493,7 @@ void DirectoryView::set_should_show_dotfiles(bool show_dotfiles)
|
|||
|
||||
void DirectoryView::launch(URL::URL const&, LauncherHandler const& launcher_handler) const
|
||||
{
|
||||
// FIXME: Add posix_spawnattr_t support to Core::Process and use it here.
|
||||
pid_t child;
|
||||
|
||||
posix_spawnattr_t spawn_attributes;
|
||||
|
@ -509,8 +510,15 @@ void DirectoryView::launch(URL::URL const&, LauncherHandler const& launcher_hand
|
|||
posix_spawn_file_actions_init(&spawn_actions);
|
||||
posix_spawn_file_actions_addchdir(&spawn_actions, path().characters());
|
||||
|
||||
char const* argv[] = { launcher_handler.details().name.characters(), nullptr };
|
||||
errno = posix_spawn(&child, launcher_handler.details().executable.characters(), &spawn_actions, &spawn_attributes, const_cast<char**>(argv), environ);
|
||||
Vector<char const*, 2> argv;
|
||||
argv.append(launcher_handler.details().name.characters());
|
||||
|
||||
for (auto const& argument : launcher_handler.details().arguments)
|
||||
argv.append(argument.characters());
|
||||
|
||||
argv.append(nullptr);
|
||||
|
||||
errno = posix_spawn(&child, launcher_handler.details().executable.characters(), &spawn_actions, &spawn_attributes, const_cast<char**>(argv.data()), environ);
|
||||
if (errno) {
|
||||
perror("posix_spawn");
|
||||
} else if (disown(child) < 0) {
|
||||
|
|
Loading…
Reference in a new issue