Closed DaveDavenport closed 4 years ago
Sorry wanted this to be split, but forgot to push to separate branch.
2nd commit removes the popen2/execl in favour of glib g_spawn_async function.
It also solves a minor memory leak with pd->cmd
.
It also popup an small message when failed to launch.
No problem, these contributions are great nonetheless! With popen2/execl the reason of failure is shown on the rofi modal's message block to help in cases rofi is launched outside command prompt (e.g. keyboard shortcut on a Desktop Environment), however, the amount of launch error situations are expected to be so small it is acceptable to be shown on commad prompt, I am going to change to print on stderr instead of stdout .
Seems like g_spawn_async_with_pipes does not trigger on_child_status when child exits, I am going to revert this part to popen2/execl.
my bad.. missed that one :(
probably needs the: G_SPAWN_DO_NOT_REAP_CHILD flag
G_SPAWN_DO_NOT_REAP_CHILD | the child will not be automatically reaped; you must use g_child_watch_add()yourself (or call waitpid() or handle SIGCHLD yourself), or the child will become a zombie.
-- | --
Bumping this only to save a note for future reference:
Now that I had the time to test it, G_SPAWN_DO_NOT_REAP_CHILD fixed it, changed back to g_spawn. Just had to make some changes to maintain the same behavior when failing to load script.
I don't think a full
g_strdup_printf
if needed in these situations.